@stdlib/ndarray-base-nullary

Apply a nullary function and assign results to elements in an output ndarray.

https://github.com/stdlib-js/ndarray-base-nullary

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.8%) to scientific vocabulary

Keywords

apply array base foreach javascript map ndarray node node-js nodejs nullary stdlib strided transform
Last synced: 6 months ago · JSON representation ·

Repository

Apply a nullary function and assign results to elements in an output ndarray.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
apply array base foreach javascript map ndarray node node-js nodejs nullary stdlib strided transform
Created almost 3 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

About stdlib...

We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.

The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.

When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.

To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

Nullary

NPM version Build Status Coverage Status <!-- dependencies -->

Apply a nullary callback and assign results to elements in an output ndarray.

## Installation ```bash npm install @stdlib/ndarray-base-nullary ``` Alternatively, - To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]). - If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions). - For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]). The [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships. To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
## Usage ```javascript var nullary = require( '@stdlib/ndarray-base-nullary' ); ``` #### nullary( arrays, fcn ) Applies a nullary callback and assigns results to elements in an output ndarray. ```javascript var Float64Array = require( '@stdlib/array-float64' ); function fcn() { return 10.0; } // Create data buffers: var xbuf = new Float64Array( 12 ); // Define the shape of the output array: var shape = [ 3, 1, 2 ]; // Define the array strides: var sx = [ 4, 4, 1 ]; // Define the index offset: var ox = 1; // Create the output ndarray-like object: var x = { 'dtype': 'float64', 'data': xbuf, 'shape': shape, 'strides': sx, 'offset': ox, 'order': 'row-major' }; // Apply the nullary function: nullary( [ x ], fcn ); console.log( x.data ); // => [ 0.0, 10.0, 10.0, 0.0, 0.0, 10.0, 10.0, 0.0, 0.0, 10.0, 10.0, 0.0 ] ``` The function accepts the following arguments: - **arrays**: array-like object containing an output ndarray. - **fcn**: nullary function to apply. The 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).
## Notes - For very high-dimensional ndarrays which are non-contiguous, one should consider copying the underlying data to contiguous memory before applying a nullary function in order to achieve better performance.
## Examples ```javascript var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; var filledarray = require( '@stdlib/array-filled' ); var ndarray2array = require( '@stdlib/ndarray-base-to-array' ); var nullary = require( '@stdlib/ndarray-base-nullary' ); var x = { 'dtype': 'generic', 'data': filledarray( 0, 10, 'generic' ), 'shape': [ 5, 2 ], 'strides': [ 2, 1 ], 'offset': 0, 'order': 'row-major' }; nullary( [ x ], discreteUniform( -100, 100 ) ); console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) ); ```

## C APIs
Character codes for data types: - **x**: `bool` (boolean). - **z**: `complex128` (double-precision floating-point complex number). - **c**: `complex64` (single-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(...) {...} ``` is a function which accepts one double-precision floating-point output ndarray. In other words, the suffix encodes the function type signature. To support callbacks whose return values are of a different data type than the output ndarray data types, the naming convention supports appending an `as` suffix. For example, ```c void stdlib_ndarray_f_as_d(...) {...} ``` is a function which accepts one single-precision floating-point output ndarray. However, the callback returns double-precision floating-point numbers. Accordingly, the output values need to be cast using the following conversion sequence ```c // Evaluate the callback: double out = f(); // Convert the callback return value to single-precision: x[ i ] = (float)out; ```
### Usage ```c #include "stdlib/ndarray/base/nullary.h" ``` #### stdlib_ndarray_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 2, 1 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static stdlib_complex64_t fcn( void ) { // ... } // Apply the callback: int8_t status = stdlib_ndarray_c( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `stdlib_complex64_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_c_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c_as_f( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static float fcn( void ) { return 10.0f; } // Apply the callback: int8_t status = stdlib_ndarray_c_as_f( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `float (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c_as_f( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c_as_k( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_c_as_k( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c_as_k( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c_as_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_c_as_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c_as_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c_as_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_c_as_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c_as_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_c_as_z( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static stdlib_complex128_t fcn( void ) { // ... } // Apply the callback: int8_t status = stdlib_ndarray_c_as_z( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `stdlib_complex128_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_c_as_z( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static double fcn( void ) { return 10.0; } // Apply the callback: int8_t status = stdlib_ndarray_d( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `double (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_f( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static float fcn( void ) { return 10.0f; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_f( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `float (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_f( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_i( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int32_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_i( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int32_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_i( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_k( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_k( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_k( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_d_as_u( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 16, 8 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint32_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_d_as_u( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint32_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_d_as_u( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_f( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static float fcn( void ) { return 10.0f; } // Apply the callback: int8_t status = stdlib_ndarray_f( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `float (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_f( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_f_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_f_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_f_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_f_as_d( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static double fcn( void ) { return 10.0; } // Apply the callback: int8_t status = stdlib_ndarray_f_as_d( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `double (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_f_as_d( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_f_as_k( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_f_as_k( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_f_as_k( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_f_as_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_f_as_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_f_as_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_f_as_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_f_as_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_f_as_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_i( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int32_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_i( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int32_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_i( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_i_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_i_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_i_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_i_as_k( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_i_as_k( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_i_as_k( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_i_as_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_i_as_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_i_as_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_i_as_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_i_as_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_i_as_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_k( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 4, 2 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_k( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_k( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_k_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 4, 2 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_k_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_k_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_k_as_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 4, 2 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_k_as_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_k_as_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 2, 1 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 4, 2 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_t_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 4, 2 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_t_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_t_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_u( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint32_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_u( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint32_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_u( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_u_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_u_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_u_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_u_as_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 8, 4 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_u_as_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_u_as_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_x( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 2, 1 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static bool fcn( void ) { return true; } // Apply the callback: int8_t status = stdlib_ndarray_x( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `bool (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_x( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static stdlib_complex128_t fcn( void ) { // ... } // Apply the callback: int8_t status = stdlib_ndarray_z( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `stdlib_complex128_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_b( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_b( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_b( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_c( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static stdlib_complex64_t fcn( void ) { // ... } // Apply the callback: int8_t status = stdlib_ndarray_z_as_c( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `stdlib_complex64_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_c( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_d( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static double fcn( void ) { return 10.0; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_d( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `double (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_d( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_f( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static float fcn( void ) { return 10.0f; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_f( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `float (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_f( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_i( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int32_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_i( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int32_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_i( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_k( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_k( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_k( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_s( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static int8_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_s( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `int8_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_s( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_t( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint16_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_t( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint16_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_t( struct ndarray *arrays[], void *fcn ); ``` #### stdlib_ndarray_z_as_u( \*arrays\[], \*fcn ) Applies a nullary callback 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 type: enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 2; // Define the array shape: int64_t shape[] = { 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16 }; // Define the index offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output ndarray: struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); if ( x == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( EXIT_FAILURE ); } // Create an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Define a callback: static uint32_t fcn( void ) { return 10; } // Apply the callback: int8_t status = stdlib_ndarray_z_as_u( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // ... // Free allocated memory: stdlib_ndarray_free( x ); ``` The function accepts the following arguments: - **arrays**: `[inout] struct ndarray**` array whose only element is a pointer to an output ndarray. - **fcn**: `[in] void*` a `uint32_t (*f)()` function to apply provided as a `void` pointer. ```c int8_t stdlib_ndarray_z_as_u( struct ndarray *arrays[], void *fcn ); ```

### Examples ```c #include "stdlib/ndarray/base/nullary.h" #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 fcn( void ) { return 10.0; } int main( void ) { // Define the ndarray data type: enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_FLOAT64; // Create an underlying byte array: uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Define the number of dimensions: int64_t ndims = 3; // Define the array shape: int64_t shape[] = { 2, 2, 2 }; // Define the strides: int64_t sx[] = { 32, 16, 8 }; // Define the offset: int64_t ox = 0; // Define the array order: enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; // Specify the index mode: enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; // Specify the subscript index modes: int8_t submodes[] = { imode }; int64_t nsubmodes = 1; // Create an output 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 ); } // Define an array containing a pointer to the ndarray: struct ndarray *arrays[] = { x }; // Apply the callback: int8_t status = stdlib_ndarray_d( arrays, (void *)fcn ); if ( status != 0 ) { fprintf( stderr, "Error during computation.\n" ); exit( EXIT_FAILURE ); } // Print the results: print_ndarray_contents( x ); fprintf( stdout, "\n" ); // Free allocated memory: stdlib_ndarray_free( x ); } ```

* * * ## 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. 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]. #### Community [![Chat][chat-image]][chat-url] --- ## License See [LICENSE][stdlib-license]. ## Copyright Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].

Owner

  • Name: stdlib
  • Login: stdlib-js
  • Kind: organization

Standard library for JavaScript.

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Push event: 26
Last Year
  • Push event: 26

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 32 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 4
npmjs.org: @stdlib/ndarray-base-nullary

Apply a nullary function and assign results to elements in an output ndarray.

  • Homepage: https://stdlib.io
  • License: Apache-2.0
  • Latest release: 0.3.0
    published over 1 year ago
  • Versions: 5
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 32 Last month
Rankings
Forks count: 15.8%
Stargazers count: 21.5%
Average: 32.4%
Dependent repos count: 37.3%
Dependent packages count: 55.0%
Funding
  • type: opencollective
  • url: https://opencollective.com/stdlib
Last synced: 6 months ago