diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/README.md b/lib/node_modules/@stdlib/ndarray/base/mskfilter/README.md new file mode 100644 index 000000000000..d1c268296fc7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/README.md @@ -0,0 +1,5518 @@ + + +# mskfilter + +> Apply a mask to a provided input ndarray and assign unmasked values to elements in a provided one-dimensional output ndarray. + +
+ +
+ + + +
+ +## Usage + +```javascript +var mskfilter = require( '@stdlib/ndarray/base/mskfilter' ); +``` + +#### mskfilter( arrays ) + +Apply a mask to a provided input ndarray and assign unmasked values to elements in a provided one-dimensional output ndarray. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); + +// Define the shape of the input and mask arrays: +var shape = [ 3, 1, 2 ]; + +// Define the array strides: +var sx = [ 2, 2, 1 ]; +var sm = [ 2, 2, 1 ]; +var sy = [ 1 ]; + +// Define the index offsets: +var ox = 1; +var om = 0; + +// Create the input, mask and output ndarray-like objects: +var x = { + 'dtype': 'float64', + 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), + 'shape': shape, + 'strides': sx, + 'offset': ox, + 'order': 'row-major' +}; +var mask = { + 'dtype': 'uint8', + 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), + 'shape': shape, + 'strides': sm, + 'offset': om, + 'order': 'row-major' +}; +var out = { + 'dtype': 'float64', + 'data': new Float64Array( 3 ), + 'shape': [ 3 ], + 'strides': sy, + 'offset': 0, + 'order': 'row-major' +}; + +mskfilter( [ x, mask, out ] ); + +console.log( out.data ); +// => [ 2.0, 4.0, 6.0 ] +``` + +The function accepts the following arguments: + +- **arrays**: array-like object containing input ndarray, mask ndarray and one dimensional output ndarray. + +Each provided ndarray should be an object with the following properties: + +- **dtype**: data type. +- **data**: data buffer. +- **shape**: dimensions. +- **strides**: stride lengths. +- **offset**: index offset. +- **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style). + +
+ + + +
+ +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var mskfilter = require( '@stdlib/ndarray/base/mskfilter' ); + +var N = 10; +var shape = [ 5, 2 ]; +var x = { + 'dtype': 'float64', + 'data': filledarrayBy( N, 'float64', discreteUniform( -100, 100 ) ), + 'shape': shape, + 'strides': [ 2, 1 ], + 'offset': 0, + 'order': 'row-major' +}; +var mask = { + 'dtype': 'uint8', + 'data': filledarrayBy( N, 'uint8', discreteUniform( 0, 1 ) ), + 'shape': shape, + 'strides': [ 2, 1 ], + 'offset': 0, + 'order': 'row-major' +}; +var y = { + 'dtype': 'float64', + 'data': filledarray( 0, N, 'float64' ), + 'shape': [ N ], + 'strides': [ 1 ], + 'offset': 0, + 'order': 'row-major' +}; + +mskfilter( [ x, mask, y ] ); +console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) ); +console.log( ndarray2array( mask.data, mask.shape, mask.strides, mask.offset, mask.order ) ); // eslint-disable max-len +console.log( ndarray2array( y.data, y.shape, y.strides, y.offset, y.order ) ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +Character codes for data types: + + + + + +- **x**: `bool` (boolean). +- **c**: `complex64` (single-precision floating-point complex number). +- **z**: `complex128` (double-precision floating-point complex number). +- **f**: `float32` (single-precision floating-point number). +- **d**: `float64` (double-precision floating-point number). +- **k**: `int16` (signed 16-bit integer). +- **i**: `int32` (signed 32-bit integer). +- **s**: `int8` (signed 8-bit integer). +- **t**: `uint16` (unsigned 16-bit integer). +- **u**: `uint32` (unsigned 32-bit integer). +- **b**: `uint8` (unsigned 8-bit integer). + + + +Function name suffix naming convention: + +```text +stdlib_ndarray_mskfilter__ +``` + +For example, + + + +```c +void stdlib_ndarray_mskfilter_d_d(...) {...} +``` + +is a function which accepts one double-precision floating-point input ndarray, one mask ndarray and one double-precision floating-point output ndarray. In other words, the suffix encodes the function type signature. + + + + + +
+ +### Usage + +```c +#include "stdlib/ndarray/base/mskfilter.h" +``` + + + + + +#### stdlib_ndarray_mskfilter_b_b( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 1 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_b( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_b( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_f( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_f( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_f( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_i( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_i( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_i( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_k( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_k( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_k( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_t( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_t( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_t( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_u( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_u( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_u( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_b_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_b_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_b_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_c_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 16, 8 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_c_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_c_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_c_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 16, 8 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_c_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_c_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_d_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 16, 8 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_d_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_d_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_d_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 16, 8 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_d_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_d_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_d_f( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 16, 8 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_d_f( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_d_f( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_d_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 16, 8 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_d_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_d_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_f_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_f_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_f_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_f_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_f_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_f_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_f_f( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_f_f( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_f_f( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_f_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_f_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_f_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_i_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_i_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_i_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_i_i( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_i_i( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_i_i( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_i_u( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_i_u( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_i_u( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_i_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_i_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_i_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_f( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_f( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_f( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_i( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_i( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_i( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_k( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_k( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_k( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_t( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_t( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_t( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_u( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_u( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_u( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_k_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_k_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_k_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_b( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 1 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_b( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_b( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_f( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_f( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_f( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_i( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_i( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_i( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_k( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_k( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_k( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_s( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 1 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_s( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_s( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_t( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_t( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_t( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_u( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_u( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_u( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_s_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_s_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_s_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_f( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_f( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_f( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_i( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_i( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_i( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_t( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 2 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_t( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_t( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_u( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_u( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_u( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_t_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 4, 2 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_t_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_t_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_u_d( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_u_d( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_u_d( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_u_u( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 4 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_u_u( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_u_u( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_u_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 8, 4 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_u_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_u_z( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_x_x( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 2, 1 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 1 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_x_x( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_x_x( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_z_c( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 32, 16 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 8 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_z_c( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_z_c( struct ndarray *arrays[] ); +``` + +#### stdlib_ndarray_mskfilter_z_z( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h" +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; + +// Create underlying byte arrays: +uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +uint8_t mbuf[] = { 0, 0, 0, 0 }; +uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { 2, 2 }; +int64_t shy[] = { 2, 2 }; +int64_t shm[] = { 4 }; + +// Define the strides: +int64_t sx[] = { 32, 16 }; +int64_t sm[] = { 2, 1 }; +int64_t sy[] = { 16 }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_z_z( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_z_z( struct ndarray *arrays[] ); +``` + + + + + + + + + +
+ + + + + +
+ +
+ + + + + +* * * + +
+ +### Examples + +
+ + + +
+ + + +
+ + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_blocked_columnmajor.js new file mode 100644 index 000000000000..263dcb6cf45f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/10d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/10.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 9 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_blocked_rowmajor.js new file mode 100644 index 000000000000..f5a645e5b070 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/10d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/10.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 9 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_columnmajor.js new file mode 100644 index 000000000000..63558a7405a0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/10d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/10.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 9 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_rowmajor.js new file mode 100644 index 000000000000..0b26c95db598 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.10d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/10d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/10.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 9 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.11d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.11d_columnmajor.js new file mode 100644 index 000000000000..4dd2500174f0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.11d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/nd.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/11.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 10 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.11d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.11d_rowmajor.js new file mode 100644 index 000000000000..ad2b8379f675 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.11d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/nd.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/11.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 10 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.1d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.1d_columnmajor.js new file mode 100644 index 000000000000..c835a14ecc0a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.1d_columnmajor.js @@ -0,0 +1,143 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( [ x, mask, y ] ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.1d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.1d_rowmajor.js new file mode 100644 index 000000000000..8bdd01015c2a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.1d_rowmajor.js @@ -0,0 +1,143 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( [ x, mask, y ] ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_blocked_columnmajor.js new file mode 100644 index 000000000000..5ab21db76fdd --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_blocked_columnmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/2d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( sqrt( len ) ); + sh = [ len, len ]; + len *= len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_blocked_rowmajor.js new file mode 100644 index 000000000000..e67ee10f2f70 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_blocked_rowmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/2d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( sqrt( len ) ); + sh = [ len, len ]; + len *= len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_columnmajor.js new file mode 100644 index 000000000000..f184f9a3107e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_columnmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/2d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( sqrt( len ) ); + sh = [ len, len ]; + len *= len; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor.js new file mode 100644 index 000000000000..b095b14a795a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/2d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( sqrt( len ) ); + sh = [ len, len ]; + len *= len; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor_accessors.js new file mode 100644 index 000000000000..f8bb2ae62b3f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor_accessors.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/2d_accessors.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Returns an array data buffer element. +* +* @private +* @param {Collection} buf - data buffer +* @param {NonNegativeInteger} idx - element index +* @returns {*} element +*/ +function get( buf, idx ) { + return buf[ idx ]; +} + +/** +* Sets an array data buffer element. +* +* @private +* @param {Collection} buf - data buffer +* @param {NonNegativeInteger} idx - element index +* @param {*} value - value to set +*/ +function set( buf, idx, value ) { + buf[ idx ] = value; +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order, + 'accessorProtocol': true, + 'accessors': [ get, set ] + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order, + 'accessorProtocol': true, + 'accessors': [ get, set ] + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order, + 'accessorProtocol': true, + 'accessors': [ get, set ] + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( sqrt( len ) ); + sh = [ len, len ]; + len *= len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor_accessors_complex.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor_accessors_complex.js new file mode 100644 index 000000000000..db8fa122fe28 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.2d_rowmajor_accessors_complex.js @@ -0,0 +1,196 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ctors = require( '@stdlib/array/typed-complex-ctors' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/2d_accessors.js' ); + + +// VARIABLES // + +var types = [ 'complex64', 'complex128' ]; +var order = 'row-major'; +var abtype = { + 'complex64': 'float32', + 'complex128': 'float64' +}; + + +// FUNCTIONS // + +/** +* Returns an array data buffer element. +* +* @private +* @param {Collection} buf - data buffer +* @param {NonNegativeInteger} idx - element index +* @returns {*} element +*/ +function get( buf, idx ) { + return buf.get( idx ); +} + +/** +* Sets an array data buffer element. +* +* @private +* @param {Collection} buf - data buffer +* @param {NonNegativeInteger} idx - element index +* @param {*} value - value to set +*/ +function set( buf, idx, value ) { + buf.set( value, idx ); +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var xbuf; + var mbuf; + var ybuf; + var mask; + var x; + var y; + + xbuf = filledarrayBy( len*2, abtype[ dtype ], discreteUniform( -100, 100 ) ); + mbuf = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + ybuf = filledarray( 0.0, len*2, abtype[ dtype ] ); + x = { + 'dtype': dtype, + 'data': new ( ctors( dtype ) )( xbuf.buffer ), + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order, + 'accessorProtocol': true, + 'accessors': [ get, set ] + }; + mask = { + 'dtype': 'bool', + 'data': new BooleanArray( mbuf.buffer ), + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order, + 'accessorProtocol': true, + 'accessors': [ get, set ] + }; + y = { + 'dtype': dtype, + 'data': new ( ctors( dtype ) )( ybuf.buffer ), + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order, + 'accessorProtocol': true, + 'accessors': [ get, set ] + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( ybuf[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( sqrt( len ) ); + sh = [ len, len ]; + len *= len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_blocked_columnmajor.js new file mode 100644 index 000000000000..88ccbdd85b81 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_blocked_columnmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var cbrt = require( '@stdlib/math/base/special/cbrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/3d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( cbrt( len ) ); + sh = [ len, len, len ]; + len *= len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_blocked_rowmajor.js new file mode 100644 index 000000000000..c4e2c8a23e31 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_blocked_rowmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var cbrt = require( '@stdlib/math/base/special/cbrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/3d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( cbrt( len ) ); + sh = [ len, len, len ]; + len *= len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_columnmajor.js new file mode 100644 index 000000000000..2987fe63d53c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_columnmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var cbrt = require( '@stdlib/math/base/special/cbrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/3d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( cbrt( len ) ); + sh = [ len, len, len ]; + len *= len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_rowmajor.js new file mode 100644 index 000000000000..4b037a73a2d9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.3d_rowmajor.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var cbrt = require( '@stdlib/math/base/special/cbrt' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/3d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( cbrt( len ) ); + sh = [ len, len, len ]; + len *= len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_blocked_columnmajor.js new file mode 100644 index 000000000000..954041704f1d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/4d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/4.0 ) ); + sh = [ len, len, len, len ]; + len *= len * len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_blocked_rowmajor.js new file mode 100644 index 000000000000..f88ae675420d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/4d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/4.0 ) ); + sh = [ len, len, len, len ]; + len *= len * len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_columnmajor.js new file mode 100644 index 000000000000..acb2d507b6b8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/4d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/4.0 ) ); + sh = [ len, len, len, len ]; + len *= len * len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_rowmajor.js new file mode 100644 index 000000000000..e5c48637a6dc --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.4d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/4d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/4.0 ) ); + sh = [ len, len, len, len ]; + len *= len * len * len; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_blocked_columnmajor.js new file mode 100644 index 000000000000..83f837585a15 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/5d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/5.0 ) ); + sh = [ len, len, len, len, len ]; + len *= pow( len, 4 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_blocked_rowmajor.js new file mode 100644 index 000000000000..fafa07170893 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/5d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/5.0 ) ); + sh = [ len, len, len, len, len ]; + len *= pow( len, 4 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_columnmajor.js new file mode 100644 index 000000000000..14beef6e69ea --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/5d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/5.0 ) ); + sh = [ len, len, len, len, len ]; + len *= pow( len, 4 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_rowmajor.js new file mode 100644 index 000000000000..a1f7a0776cf7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.5d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/5d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/5.0 ) ); + sh = [ len, len, len, len, len ]; + len *= pow( len, 4 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_blocked_columnmajor.js new file mode 100644 index 000000000000..76f8d40a743f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/6d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/6.0 ) ); + sh = [ len, len, len, len, len, len ]; + len *= pow( len, 5 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_blocked_rowmajor.js new file mode 100644 index 000000000000..3744eb8c043f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/6d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/6.0 ) ); + sh = [ len, len, len, len, len, len ]; + len *= pow( len, 5 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_columnmajor.js new file mode 100644 index 000000000000..5a1ab332f76a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/6d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/6.0 ) ); + sh = [ len, len, len, len, len, len ]; + len *= pow( len, 5 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_rowmajor.js new file mode 100644 index 000000000000..ee7e379be5b8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.6d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/6d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/6.0 ) ); + sh = [ len, len, len, len, len, len ]; + len *= pow( len, 5 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_blocked_columnmajor.js new file mode 100644 index 000000000000..070c7f3d71fb --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/7d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/7.0 ) ); + sh = [ len, len, len, len, len, len, len ]; + len *= pow( len, 6 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_blocked_rowmajor.js new file mode 100644 index 000000000000..b8e17feed44e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/7d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/7.0 ) ); + sh = [ len, len, len, len, len, len, len ]; + len *= pow( len, 6 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_columnmajor.js new file mode 100644 index 000000000000..5944a0f499e0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/7d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/7.0 ) ); + sh = [ len, len, len, len, len, len, len ]; + len *= pow( len, 6 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_rowmajor.js new file mode 100644 index 000000000000..27a04b5c8cba --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.7d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/7d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/7.0 ) ); + sh = [ len, len, len, len, len, len, len ]; + len *= pow( len, 6 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_blocked_columnmajor.js new file mode 100644 index 000000000000..e66ab49b00d8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/8d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/8.0 ) ); + sh = [ len, len, len, len, len, len, len, len ]; + len *= pow( len, 7 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_blocked_rowmajor.js new file mode 100644 index 000000000000..44f12dee72f6 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/8d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/8.0 ) ); + sh = [ len, len, len, len, len, len, len, len ]; + len *= pow( len, 7 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_columnmajor.js new file mode 100644 index 000000000000..20ab1cf8a0d8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/8d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/8.0 ) ); + sh = [ len, len, len, len, len, len, len, len ]; + len *= pow( len, 7 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_rowmajor.js new file mode 100644 index 000000000000..29cd820ee0ea --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.8d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/8d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/8.0 ) ); + sh = [ len, len, len, len, len, len, len, len ]; + len *= pow( len, 7 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_blocked_columnmajor.js new file mode 100644 index 000000000000..8b25905ca91f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_blocked_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/9d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/9.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 8 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_blocked_rowmajor.js new file mode 100644 index 000000000000..c082cca7b305 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_blocked_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/9d_blocked.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/9.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 8 ); + f = createBenchmark( len, sh, t ); + bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_columnmajor.js new file mode 100644 index 000000000000..8a01be1eb3a5 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_columnmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/9d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'column-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/9.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 8 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_rowmajor.js new file mode 100644 index 000000000000..b08d316a8703 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/benchmark/benchmark.9d_rowmajor.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var pkg = require( './../package.json' ).name; +var mskfilter = require( './../lib/9d.js' ); + + +// VARIABLES // + +var types = [ 'float64' ]; +var order = 'row-major'; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @param {NonNegativeIntegerArray} shape - ndarray shape +* @param {string} dtype - input and output ndarray data type +* @returns {Function} benchmark function +*/ +function createBenchmark( len, shape, dtype ) { + var mask; + var x; + var y; + + x = filledarrayBy( len, dtype, discreteUniform( -100, 100 ) ); + mask = filledarrayBy( len, 'uint8', discreteUniform( 0, 1 ) ); + y = filledarray( 0.0, len, dtype ); + x = { + 'dtype': dtype, + 'data': x, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + mask = { + 'dtype': 'uint8', + 'data': mask, + 'shape': shape, + 'strides': shape2strides( shape, order ), + 'offset': 0, + 'order': order + }; + y = { + 'dtype': dtype, + 'data': y, + 'shape': [ len ], + 'strides': [ 1 ], + 'offset': 0, + 'order': order + }; + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + mskfilter( x, mask, y ); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y.data[ i%len ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var sh; + var t; + var f; + var i; + var j; + + min = 1; // 10^min + max = 6; // 10^max + + for ( j = 0; j < types.length; j++ ) { + t = types[ j ]; + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + + len = floor( pow( len, 1.0/9.0 ) ); + sh = [ len, len, len, len, len, len, len, len, len ]; + len *= pow( len, 8 ); + f = createBenchmark( len, sh, t ); + bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],order='+order+',dtype='+t, f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/repl.txt new file mode 100644 index 000000000000..692ada181157 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/repl.txt @@ -0,0 +1,44 @@ + +{{alias}}( arrays ) + Applies a mask to a provided input ndarray and assigns unmasked values to + elements in a provided one-dimensional output ndarray. + + A provided "ndarray" should be an `object` with the following properties: + + - dtype: data type. + - data: data buffer. + - shape: dimensions. + - strides: stride lengths. + - offset: index offset. + - order: specifies whether an ndarray is row-major (C-style) or column-major + (Fortran-style). + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing an input, mask, and output ndarray. + + Examples + -------- + // Define ndarray data and meta data... + > var xbuf = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ); + > var mbuf = new {{alias:@stdlib/array/uint8}}( [ 1, 0, 1, 0, 1, 0 ] ); + > var ybuf = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0 ] ); + > var shape = [ 3, 1, 2 ]; + > var sx = [ 2, 2, 1 ]; + > var sm = [ 2, 2, 1 ]; + > var sy = [ 1 ]; + > var ox = 1; + > var om = 0; + > var order = 'row-major'; + + // Using an ndarray... + > var x = {{alias:@stdlib/ndarray/ctor}}( 'float64', xbuf, shape, sx, ox, order ); + > var mask = {{alias:@stdlib/ndarray/ctor}}( 'uint8', mbuf, shape, sm, om, order ); + > var y = {{alias:@stdlib/ndarray/ctor}}( 'float64', ybuf, [ 3 ], sy, 0, order ); + > {{alias}}( [ x, mask, y ] ); + > y.data + [ 2.0, 4.0, 6.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/types/index.d.ts new file mode 100644 index 000000000000..16a63c39d81b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/types/index.d.ts @@ -0,0 +1,83 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { ArrayLike } from '@stdlib/types/array'; +import { ndarray } from '@stdlib/types/ndarray'; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @param arrays - array-like object containing an input array, a mask array, and an output array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the input and mask arrays: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 2, 1 ]; +* var sm = [ 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offsets: +* var ox = 1; +* var om = 0; +* +* // Create the input, mask, and output ndarray-like objects: +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* var out = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter( [ x, mask, out ] ); +* +* console.log( out.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +declare function mskfilter( arrays: ArrayLike ): void; + + +// EXPORTS // + +export = mskfilter; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/types/test.ts new file mode 100644 index 000000000000..9cb0304bcf70 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/docs/types/test.ts @@ -0,0 +1,81 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/// + +import { ndarray } from '@stdlib/types/ndarray'; +import mskfilter = require( './index' ); + +/** +* Mock function to create an ndarray-like object. +* +* @return ndarray-like object +*/ +function array(): ndarray { + const obj: ndarray = { + 'byteLength': 80, + 'BYTES_PER_ELEMENT': 8, + 'data': new Float64Array( 10 ), + 'dtype': 'float64', + 'flags': { + 'ROW_MAJOR_CONTIGUOUS': true, + 'COLUMN_MAJOR_CONTIGUOUS': false + }, + 'length': 10, + 'ndims': 1, + 'offset': 0, + 'order': 'row-major', + 'shape': [ 10 ], + 'strides': [ 1 ], + 'get': (): number => 0, + 'set': (): ndarray => obj + }; + return obj; +} + + +// TESTS // + +// The function returns `undefined`... +{ + const x = array(); + const arrays = [ x, x, x ]; + + mskfilter( arrays ); // $ExpectType void +} + +// The compiler throws an error if the function is provided a first argument which is not an array-like object containing ndarray-like objects... +{ + mskfilter( 5 ); // $ExpectError + mskfilter( true ); // $ExpectError + mskfilter( false ); // $ExpectError + mskfilter( null ); // $ExpectError + mskfilter( undefined ); // $ExpectError + mskfilter( {} ); // $ExpectError + mskfilter( [ 1 ] ); // $ExpectError + mskfilter( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = array(); + const arrays = [ x ]; + + mskfilter(); // $ExpectError + mskfilter( arrays, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/examples/index.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/examples/index.js new file mode 100644 index 000000000000..e73ea6f54f80 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/examples/index.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarray = require( '@stdlib/array/filled' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var mskfilter = require( './../lib' ); + +var N = 10; +var shape = [ 5, 2 ]; +var x = { + 'dtype': 'float64', + 'data': filledarrayBy( N, 'float64', discreteUniform( -100, 100 ) ), + 'shape': shape, + 'strides': [ 2, 1 ], + 'offset': 0, + 'order': 'row-major' +}; +var mask = { + 'dtype': 'uint8', + 'data': filledarrayBy( N, 'uint8', discreteUniform( 0, 1 ) ), + 'shape': shape, + 'strides': [ 2, 1 ], + 'offset': 0, + 'order': 'row-major' +}; +var y = { + 'dtype': 'float64', + 'data': filledarray( 0, N, 'float64' ), + 'shape': [ N ], + 'strides': [ 1 ], + 'offset': 0, + 'order': 'row-major' +}; + +mskfilter( [ x, mask, y ] ); +console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) ); +console.log( ndarray2array( mask.data, mask.shape, mask.strides, mask.offset, mask.order ) ); +console.log( ndarray2array( y.data, y.shape, y.strides, y.offset, y.order ) ); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter.h new file mode 100644 index 000000000000..b60ba7659858 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter.h @@ -0,0 +1,99 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** +* Header file containing function declarations for ndarray functions which apply a nullary function. +*/ +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_H + +#include "mskfilter/macros.h" +#include "mskfilter/typedefs.h" +#include "mskfilter/dispatch_object.h" +#include "mskfilter/dispatch.h" + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +// BEGIN LOOPS +#include "mskfilter/b_b.h" +#include "mskfilter/b_c.h" +#include "mskfilter/b_d.h" +#include "mskfilter/b_f.h" +#include "mskfilter/b_i.h" +#include "mskfilter/b_k.h" +#include "mskfilter/b_t.h" +#include "mskfilter/b_u.h" +#include "mskfilter/b_z.h" + +#include "mskfilter/c_c.h" +#include "mskfilter/c_z.h" + +#include "mskfilter/d_c.h" +#include "mskfilter/d_d.h" +#include "mskfilter/d_f.h" +#include "mskfilter/d_z.h" + +#include "mskfilter/f_c.h" +#include "mskfilter/f_d.h" +#include "mskfilter/f_f.h" +#include "mskfilter/f_z.h" + +#include "mskfilter/i_d.h" +#include "mskfilter/i_i.h" +#include "mskfilter/i_u.h" +#include "mskfilter/i_z.h" + +#include "mskfilter/k_c.h" +#include "mskfilter/k_d.h" +#include "mskfilter/k_f.h" +#include "mskfilter/k_i.h" +#include "mskfilter/k_k.h" +#include "mskfilter/k_t.h" +#include "mskfilter/k_u.h" +#include "mskfilter/k_z.h" + +#include "mskfilter/s_b.h" +#include "mskfilter/s_c.h" +#include "mskfilter/s_d.h" +#include "mskfilter/s_f.h" +#include "mskfilter/s_i.h" +#include "mskfilter/s_k.h" +#include "mskfilter/s_s.h" +#include "mskfilter/s_t.h" +#include "mskfilter/s_u.h" +#include "mskfilter/s_z.h" + +#include "mskfilter/t_c.h" +#include "mskfilter/t_d.h" +#include "mskfilter/t_f.h" +#include "mskfilter/t_i.h" +#include "mskfilter/t_t.h" +#include "mskfilter/t_u.h" +#include "mskfilter/t_z.h" + +#include "mskfilter/u_d.h" +#include "mskfilter/u_u.h" +#include "mskfilter/u_z.h" + +#include "mskfilter/x_x.h" + +#include "mskfilter/z_c.h" +#include "mskfilter/z_z.h" +// END LOOPS diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_b.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_b.h new file mode 100644 index 000000000000..f4314ea7bb4c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_b.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_B_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_B_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_b_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_B_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_c.h new file mode 100644 index 000000000000..a5af0c27b96e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_d.h new file mode 100644 index 000000000000..fb83117100fa --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_f.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_f.h new file mode 100644 index 000000000000..2f62ec9b9b0b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_f.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_F_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_F_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_f_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_F_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_i.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_i.h new file mode 100644 index 000000000000..93f202d95bc0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_i.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_I_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_I_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_i_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_I_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_k.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_k.h new file mode 100644 index 000000000000..f418fbd1f863 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_k.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_K_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_K_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_k_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_K_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_t.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_t.h new file mode 100644 index 000000000000..c08188db460b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_t.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_T_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_T_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_t_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_T_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_u.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_u.h new file mode 100644 index 000000000000..0f69726d2222 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_u.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_U_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_U_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_u_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_U_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_z.h new file mode 100644 index 000000000000..b2a7ef2be780 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/b_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_B_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_B_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_b_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_B_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/c_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/c_c.h new file mode 100644 index 000000000000..52e5486e4112 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/c_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_C_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_C_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_C_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/c_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/c_z.h new file mode 100644 index 000000000000..eaaf724f8b52 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/c_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_C_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_C_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_c_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_C_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_c.h new file mode 100644 index 000000000000..0f2797f420a9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_D_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_D_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_D_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_d.h new file mode 100644 index 000000000000..eddf82e28b7f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_D_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_D_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_D_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_f.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_f.h new file mode 100644 index 000000000000..a53dbd6cbf09 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_f.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_D_F_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_D_F_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_f_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_D_F_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_z.h new file mode 100644 index 000000000000..1b9043f6a384 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/d_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_D_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_D_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_d_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_D_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/dispatch.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/dispatch.h new file mode 100644 index 000000000000..a69e6da5812d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/dispatch.h @@ -0,0 +1,42 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_DISPATCH_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_DISPATCH_H + +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Dispatches to a unary ndarray function according to the dimensionality of provided ndarray arguments. +*/ +int8_t stdlib_ndarray_unary_mskfilter_dispatch( const struct ndarrayUnaryMskfilterDispatchObject *obj, struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_DISPATCH_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/dispatch_object.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/dispatch_object.h new file mode 100644 index 000000000000..77772d6b96ed --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/dispatch_object.h @@ -0,0 +1,94 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_DISPATCH_OBJECT_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_DISPATCH_OBJECT_H + +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Structure for grouping unary function dispatch information. +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include +* #include +* +* ndarrayUnaryMskfilterFcn functions[] = { +* stdlib_ndarray_mskfilter_b_b_0d, +* stdlib_ndarray_mskfilter_b_b_1d, +* stdlib_ndarray_mskfilter_b_b_2d, +* stdlib_ndarray_mskfilter_b_b_3d, +* stdlib_ndarray_mskfilter_b_b_4d, +* stdlib_ndarray_mskfilter_b_b_5d, +* stdlib_ndarray_mskfilter_b_b_6d, +* stdlib_ndarray_mskfilter_b_b_7d, +* stdlib_ndarray_mskfilter_b_b_8d, +* stdlib_ndarray_mskfilter_b_b_9d, +* stdlib_ndarray_mskfilter_b_b_10d +* stdlib_ndarray_mskfilter_b_b_nd +* }; + +* ndarrayUnaryMskfilterFcn blocked_functions[] = { +* stdlib_ndarray_mskfilter_b_b_2d_blocked, +* stdlib_ndarray_mskfilter_b_b_3d_blocked, +* stdlib_ndarray_mskfilter_b_b_4d_blocked, +* stdlib_ndarray_mskfilter_b_b_5d_blocked, +* stdlib_ndarray_mskfilter_b_b_6d_blocked, +* stdlib_ndarray_mskfilter_b_b_7d_blocked, +* stdlib_ndarray_mskfilter_b_b_8d_blocked, +* stdlib_ndarray_mskfilter_b_b_9d_blocked, +* stdlib_ndarray_mskfilter_b_b_10d_blocked +* }; +* +* ndarrayUnaryMskfilterDispatchObject obj = { +* functions, +* 12, +* blocked_functions +* 9 +* }; +* +* // ... +*/ +struct ndarrayUnaryMskfilterDispatchObject { + // Array containing unary ndarray functions for performing element-wise mask operation: + ndarrayUnaryMskfilterFcn *functions; + + // Number of unary ndarray functions: + int32_t nfunctions; + + // Array containing unary ndarray functions for performing element-wise mask operation using loop blocking: + ndarrayUnaryMskfilterFcn *blocked_functions; + + // Number of blocked unary ndarray functions: + int32_t nblockedfunctions; +}; + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_DISPATCH_OBJECT_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_c.h new file mode 100644 index 000000000000..343bfc74653b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_F_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_F_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_F_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_d.h new file mode 100644 index 000000000000..d5218a593c7f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_F_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_F_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_F_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_f.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_f.h new file mode 100644 index 000000000000..0071787ea65b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_f.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_F_F_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_F_F_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_f_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_F_F_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_z.h new file mode 100644 index 000000000000..aa0e49d4ce64 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/f_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_F_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_F_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_f_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_F_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_d.h new file mode 100644 index 000000000000..fe7d2db32720 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_I_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_I_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_I_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_i.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_i.h new file mode 100644 index 000000000000..9564cd5a5462 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_i.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_I_I_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_I_I_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_i_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_I_I_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_u.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_u.h new file mode 100644 index 000000000000..fabc03d90570 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_u.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_I_U_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_I_U_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_u_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_I_U_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_z.h new file mode 100644 index 000000000000..edc4e4248bb9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/i_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_I_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_I_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_i_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_I_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/permute.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/permute.h new file mode 100644 index 000000000000..5848fc41891b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/permute.h @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_PERMUTE_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_PERMUTE_H + +#include + +/** +* Permutes an input array according to a provided index array. +*/ +void stdlib_ndarray_base_mskfilter_internal_permute( const int64_t n, const int64_t *arr, const int64_t *idx, int64_t *out ); + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_PERMUTE_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/range.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/range.h new file mode 100644 index 000000000000..0001123b3177 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/range.h @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_RANGE_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_RANGE_H + +#include + +/** +* Writes `n` evenly spaced values from `0` to `n-1` to an output array. +*/ +void stdlib_ndarray_base_mskfilter_internal_range( const int64_t n, int64_t *out ); + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_RANGE_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/sort2ins.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/sort2ins.h new file mode 100644 index 000000000000..aa4af334b01b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/internal/sort2ins.h @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_SORT2INS_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_SORT2INS_H + +#include + +/** +* Simultaneously sorts two arrays based on the sort order of the first array using insertion sort. +*/ +void stdlib_ndarray_base_mskfilter_internal_sort2ins( const int64_t n, int64_t *x, int64_t *y ); + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_INTERNAL_SORT2INS_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_c.h new file mode 100644 index 000000000000..897d216782a5 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_d.h new file mode 100644 index 000000000000..1decb5119802 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_f.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_f.h new file mode 100644 index 000000000000..a55a08a6ba73 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_f.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_F_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_F_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_f_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_F_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_i.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_i.h new file mode 100644 index 000000000000..c17e2470d105 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_i.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_I_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_I_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_i_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_I_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_k.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_k.h new file mode 100644 index 000000000000..7cfc52d55d1f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_k.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_K_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_K_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_k_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_K_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_t.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_t.h new file mode 100644 index 000000000000..3115d801fc33 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_t.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_T_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_T_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_t_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_T_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_u.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_u.h new file mode 100644 index 000000000000..3658d9b52aa7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_u.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_U_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_U_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_u_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_U_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_z.h new file mode 100644 index 000000000000..dafb049fdc98 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/k_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_K_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_K_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_k_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_K_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros.h new file mode 100644 index 000000000000..8bfa8bb289be --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros.h @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_H + +#include "stdlib/ndarray/base/mskfilter/macros/constants.h" +#include "stdlib/ndarray/base/mskfilter/macros/1d.h" +#include "stdlib/ndarray/base/mskfilter/macros/2d.h" +#include "stdlib/ndarray/base/mskfilter/macros/2d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/3d.h" +#include "stdlib/ndarray/base/mskfilter/macros/3d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/4d.h" +#include "stdlib/ndarray/base/mskfilter/macros/4d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/5d.h" +#include "stdlib/ndarray/base/mskfilter/macros/5d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/6d.h" +#include "stdlib/ndarray/base/mskfilter/macros/6d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/7d.h" +#include "stdlib/ndarray/base/mskfilter/macros/7d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/8d.h" +#include "stdlib/ndarray/base/mskfilter/macros/8d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/9d.h" +#include "stdlib/ndarray/base/mskfilter/macros/9d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/10d.h" +#include "stdlib/ndarray/base/mskfilter/macros/10d_blocked.h" +#include "stdlib/ndarray/base/mskfilter/macros/nd.h" + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/1d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/1d.h new file mode 100644 index 000000000000..8346da26c1b9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/1d.h @@ -0,0 +1,135 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_1D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_1D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Macro containing the preamble for a loop which operates on elements of a one-dimensional ndarray, with a mask array. +* +* ## Notes +* +* - Variable naming conventions: +* +* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. +* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. +* +* @example +* STDLIB_NDARRAY_MSKFILTER_1D_LOOP_PREMABLE { +* // Innermost loop body... +* } +* STDLIB_NDARRAY_MSKFILTER_1D_LOOP_EPILOGUE +*/ +#define STDLIB_NDARRAY_MSKFILTER_1D_LOOP_PREAMBLE \ + struct ndarray *x1 = arrays[ 0 ]; \ + struct ndarray *x2 = arrays[ 1 ]; \ + struct ndarray *x3 = arrays[ 2 ]; \ + int64_t *shx1 = stdlib_ndarray_shape( x1 ); \ + int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ + int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ + int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ + uint8_t *px1 = stdlib_ndarray_data( x1 ); \ + uint8_t *px2 = stdlib_ndarray_data( x2 ); \ + uint8_t *px3 = stdlib_ndarray_data( x3 ); \ + int64_t d0x1; \ + int64_t d0x2; \ + int64_t d0x3; \ + int64_t S0; \ + int64_t i0; \ + /* Extract loop variables: dimensions and loop offset (pointer) increments... */ \ + S0 = shx1[ 0 ]; \ + d0x1 = sx1[ 0 ]; \ + d0x2 = sx2[ 0 ]; \ + d0x3 = sx3[ 0 ]; \ + /* Set the pointers to the first indexed elements... */ \ + px1 += stdlib_ndarray_offset( x1 ); \ + px2 += stdlib_ndarray_offset( x2 ); \ + px3 += stdlib_ndarray_offset( x3 ); \ + /* Iterate over the ndarray dimensions... */ \ + for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) + +/** +* Macro containing the epilogue for loops which operate on elements of a one-dimensional ndarray with a mask. +* +* @example +* STDLIB_NDARRAY_MSKFILTER_1D_LOOP_PREMABLE { +* // Innermost loop body... +* } +* STDLIB_NDARRAY_MSKFILTER_1D_LOOP_EPILOGUE +*/ +#define STDLIB_NDARRAY_MSKFILTER_1D_LOOP_EPILOGUE + +/** +* Macro for a unary one-dimensional ndarray loop which applies mask and cast input ndarray elements and assigns unmasked values to an output ndarray. +* +* ## Notes +* +* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. +* - Retrieves a mask element according to type `uint8_t` via the pointer `px2`. +* - If the mask element is truthy then explicitly casts the ndarray element to `tout`. +* - Stores the result in an output ndarray via the pointer `px3`. +* +* @param tin input type +* @param tout output type +* +* @example +* // e.g., d_d +* STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( double, double ) +*/ +#define STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( tin, tout ) \ + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_PREAMBLE { \ + if ( *(uint8_t *)px2 ) { \ + const tin x = *(tin *)px1; \ + *(tout *)px3 = (tout)x; \ + px3 += d0x3; \ + } \ + } \ + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_EPILOGUE + +/** +* Macro for a unary one-dimensional ndarray loop which applies mask and does not cast input ndarray elements and assigns unmasked values to an output ndarray. +* +* ## Notes +* +* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. +* - Retrieves a mask element according to type `uint8_t` via the pointer `px2`. +* - If the mask element is truthy then stores the ndarray element in an output ndarray of type `tout` via the pointer `px3`. +* +* @param tin input type +* @param tout output type +* +* @example +* #include "stdlib/complex/float64/ctor.h" +* +* // e.g., z_z +* STDLIB_NDARRAY_ASSIGN_1D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) +*/ +#define STDLIB_NDARRAY_MSKFILTER_1D_LOOP_NOCAST( tin, tout ) \ + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_PREAMBLE { \ + if ( *(uint8_t *)px2 ) { \ + const tin x = *(tin *)px1; \ + *(tout *)px3 = x; \ + px3 += d0x3; \ + } \ + } \ + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_EPILOGUE + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_1D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/2d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/2d.h new file mode 100644 index 000000000000..23ea10719316 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/2d.h @@ -0,0 +1,156 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_2D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_2D_H + +#include "stdlib/ndarray/ctor.h" +#include "stdlib/ndarray/orders.h" +#include + +/** +* Macro containing the preamble for a loop which operates on elements of a two-dimensional ndarray, with a mask array. +* +* ## Notes +* +* - Variable naming conventions: +* +* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. +* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. +* +* @example +* STDLIB_NDARRAY_MSKFILTER_2D_LOOP_PREMABLE { +* // Innermost loop body... +* } +* STDLIB_NDARRAY_MSKFILTER_2D_LOOP_EPILOGUE +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_LOOP_PREAMBLE \ + struct ndarray *x1 = arrays[ 0 ]; \ + struct ndarray *x2 = arrays[ 1 ]; \ + struct ndarray *x3 = arrays[ 2 ]; \ + int64_t *shx1 = stdlib_ndarray_shape( x1 ); \ + int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ + int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ + int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ + uint8_t *px1 = stdlib_ndarray_data( x1 ); \ + uint8_t *px2 = stdlib_ndarray_data( x2 ); \ + uint8_t *px3 = stdlib_ndarray_data( x3 ); \ + int64_t d0x1; \ + int64_t d1x1; \ + int64_t d0x2; \ + int64_t d1x2; \ + int64_t d0x3; \ + int64_t S0; \ + int64_t S1; \ + int64_t i0; \ + int64_t i1; \ + /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ + if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ + /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ + S0 = shx1[ 1 ]; \ + S1 = shx1[ 0 ]; \ + d0x1 = sx1[ 1 ]; \ + d1x1 = sx1[ 0 ] - ( S0*sx1[1] ); \ + d0x2 = sx2[ 1 ]; \ + d1x2 = sx2[ 0 ] - ( S0*sx2[1] ); \ + } else { \ + /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ + S0 = shx1[ 0 ]; \ + S1 = shx1[ 1 ]; \ + d0x1 = sx1[ 0 ]; \ + d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ + d0x2 = sx2[ 0 ]; \ + d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ + } \ + d0x3 = sx3[ 0 ]; \ + /* Set the pointers to the first indexed elements... */ \ + px1 += stdlib_ndarray_offset( x1 ); \ + px2 += stdlib_ndarray_offset( x2 ); \ + px3 += stdlib_ndarray_offset( x3 ); \ + /* Iterate over the ndarray dimensions... */ \ + for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ + for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) + +/** +* Macro containing the epilogue for loops which operate on elements of a two-dimensional ndarray with a mask. +* +* @example +* STDLIB_NDARRAY_MSKFILTER_2D_LOOP_PREMABLE { +* // Innermost loop body... +* } +* STDLIB_NDARRAY_MSKFILTER_2D_LOOP_EPILOGUE +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_LOOP_EPILOGUE \ + } + +/** +* Macro for a unary two-dimensional ndarray loop which applies mask and cast input ndarray elements and assigns unmasked values to an output ndarray. +* +* ## Notes +* +* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. +* - Retrieves a mask element according to type `uint8_t` via the pointer `px2`. +* - If the mask element is truthy then explicitly casts the ndarray element to `tout`. +* - Stores the result in an output ndarray via the pointer `px3`. +* +* @param tin input type +* @param tout output type +* +* @example +* // e.g., d_d +* STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( double, double ) +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( tin, tout ) \ + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_PREAMBLE { \ + if ( *(uint8_t *)px2 ) { \ + const tin x = *(tin *)px1; \ + *(tout *)px3 = (tout)x; \ + px3 += d0x3; \ + } \ + } \ + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_EPILOGUE + +/** +* Macro for a unary one-dimensional ndarray loop which applies mask and does not cast input ndarray elements and assigns unmasked values to an output ndarray. +* +* ## Notes +* +* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. +* - Retrieves a mask element according to type `uint8_t` via the pointer `px2`. +* - If the mask element is truthy then stores the ndarray element in an output ndarray of type `tout` via the pointer `px3`. +* +* @param tin input type +* @param tout output type +* +* @example +* #include "stdlib/complex/float64/ctor.h" +* +* // e.g., z_z +* STDLIB_NDARRAY_MSKFILTER_2D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_LOOP_NOCAST( tin, tout ) \ + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_PREAMBLE { \ + if ( *(uint8_t *)px2 ) { \ + const tin x = *(tin *)px1; \ + *(tout *)px3 = x; \ + px3 += d0x3; \ + } \ + } \ + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_EPILOGUE + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_2D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/2d_blocked.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/2d_blocked.h new file mode 100644 index 000000000000..13df837bf7d9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/2d_blocked.h @@ -0,0 +1,210 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_2D_BLOCKED_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_2D_BLOCKED_H + +#include "stdlib/ndarray/base/mskfilter/macros/constants.h" +#include "stdlib/ndarray/base/mskfilter/internal/permute.h" +#include "stdlib/ndarray/base/mskfilter/internal/range.h" +#include "stdlib/ndarray/base/mskfilter/internal/sort2ins.h" +#include "stdlib/ndarray/base/bytes_per_element.h" +#include "stdlib/ndarray/ctor.h" +#include +#include + +/** +* Macro containing the preamble for blocked nested loops which operate on elements of a two-dimensional ndarray. +* +* ## Notes +* +* - Variable naming conventions: +* +* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. +* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. +* +* @example +* STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_PREMABLE { +* // Innermost loop body... +* } +* STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_EPILOGUE +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_PREAMBLE \ + struct ndarray *x1 = arrays[ 0 ]; \ + struct ndarray *x2 = arrays[ 1 ]; \ + struct ndarray *x3 = arrays[ 2 ]; \ + int64_t shx1[2]; \ + int64_t sx1[2]; \ + int64_t sx2[2]; \ + int64_t sx3[1]; \ + int64_t idx[2]; \ + int64_t tmp[2]; \ + int64_t bsize; \ + uint8_t *pbx1; \ + uint8_t *pbx2; \ + uint8_t *px1; \ + uint8_t *px2; \ + uint8_t *px3; \ + int64_t d0x1; \ + int64_t d1x1; \ + int64_t d0x2; \ + int64_t d1x2; \ + int64_t d0x3; \ + int64_t o1x1; \ + int64_t o1x2; \ + int64_t nbx1; \ + int64_t nbx2; \ + int64_t ox1; \ + int64_t ox2; \ + int64_t s0; \ + int64_t s1; \ + int64_t i0; \ + int64_t i1; \ + int64_t j0; \ + int64_t j1; \ + /* Copy strides to prevent mutation to the original ndarray: */ \ + memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ + memcpy( sx3, stdlib_ndarray_strides( x3 ), sizeof sx3 ); \ + /* Create a loop interchange index array for loop order permutation: */ \ + stdlib_ndarray_base_mskfilter_internal_range( 2, idx ); \ + /* Sort the input array strides in increasing order (of magnitude): */ \ + stdlib_ndarray_base_mskfilter_internal_sort2ins( 2, sx1, idx ); \ + /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ + stdlib_ndarray_base_mskfilter_internal_permute( 2, stdlib_ndarray_shape( x1 ), idx, tmp ); \ + memcpy( shx1, tmp, sizeof shx1 ); \ + stdlib_ndarray_base_mskfilter_internal_permute( 2, stdlib_ndarray_strides( x2 ), idx, tmp ); \ + memcpy( sx2, tmp, sizeof sx2 ); \ + /* Determine the block size... */ \ + nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ + nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ + if ( nbx1 == 0 && nbx2 == 0 ) { \ + bsize = STDLIB_NDARRAY_MSKFILTER_BLOCK_SIZE_IN_ELEMENTS; \ + } else if ( nbx1 > nbx2 ) { \ + bsize = STDLIB_NDARRAY_MSKFILTER_BLOCK_SIZE_IN_BYTES / nbx1; \ + } else { \ + bsize = STDLIB_NDARRAY_MSKFILTER_BLOCK_SIZE_IN_BYTES / nbx2; \ + } \ + /* Cache pointers to the ndarray buffers... */ \ + pbx1 = stdlib_ndarray_data( x1 ); \ + pbx2 = stdlib_ndarray_data( x2 ); \ + /* Cache byte offsets to the first indexed elements... */ \ + ox1 = stdlib_ndarray_offset( x1 ); \ + ox2 = stdlib_ndarray_offset( x2 ); \ + px3 = stdlib_ndarray_offset( x3 ); \ + /* Cache offset increments for the innermost loop... */ \ + d0x1 = sx1[0]; \ + d0x2 = sx2[0]; \ + d0x3 = sx3[0]; \ + /* Iterate over blocks... */ \ + for ( j1 = shape[1]; j1 > 0; ) { \ + if ( j1 < bsize ) { \ + s1 = j1; \ + j1 = 0; \ + } else { \ + s1 = bsize; \ + j1 -= bsize; \ + } \ + o1x1 = ox1 + ( j1*sx1[1] ); \ + o1x2 = ox2 + ( j1*sx2[1] ); \ + for ( j0 = shape[0]; j0 > 0; ) { \ + if ( j0 < bsize ) { \ + s0 = j0; \ + j0 = 0; \ + } else { \ + s0 = bsize; \ + j0 -= bsize; \ + } \ + /* Compute pointers to the first ndarray elements in the current block... */ \ + px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ + px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ + /* Compute loop offset increments... */ \ + d1x1 = sx1[1] - ( s0*sx1[0] ); \ + d1x2 = sx2[1] - ( s0*sx2[0] ); \ + /* Iterate over the ndarray dimensions... */ \ + for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ + for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) + +/** +* Macro containing the epilogue for blocked nested loops which operate on elements of a one-dimensional ndarray with a mask. +* +* @example +* STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_PREMABLE { +* // Innermost loop body... +* } +* STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_EPILOGUE +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_EPILOGUE \ + } \ + } \ + } + +/** +* Macro for a blocked unary two-dimensional ndarray loop which applies mask and cast input ndarray elements and assigns unmasked values to an output ndarray. +* +* ## Notes +* +* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. +* - Retrieves a mask element according to type `uint8_t` via the pointer `px2`. +* - If the mask element is truthy then explicitly casts the ndarray element to `tout`. +* - Stores the result in an output ndarray via the pointer `px3`. +* +* @param tin input type +* @param tout output type +* +* @example +* // e.g., d_d +* STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( double, double ) +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( tin, tout ) \ + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_PREAMBLE { \ + if ( *(uint8_t *)px2 ) { \ + const tin x = *(tin *)px1; \ + *(tout *)px3 = (tout)x; \ + px3 += d0x3; \ + } \ + } \ + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_EPILOGUE +/** +* Macro for a blocked unary one-dimensional ndarray loop which applies mask and does not cast input ndarray elements and assigns unmasked values to an output ndarray. +* +* ## Notes +* +* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. +* - Retrieves a mask element according to type `uint8_t` via the pointer `px2`. +* - If the mask element is truthy then stores the ndarray element in an output ndarray of type `tout` via the pointer `px3`. +* +* @param tin input type +* @param tout output type +* +* @example +* #include "stdlib/complex/float64/ctor.h" +* +* // e.g., z_z +* STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) +*/ +#define STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_NOCAST( tin, tout ) \ + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_PREAMBLE { \ + if ( *(uint8_t *)px2 ) { \ + const tin x = *(tin *)px1; \ + *(tout *)px3 = x; \ + px3 += d0x3; \ + } \ + } \ + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_EPILOGUE + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_2D_BLOCKED_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/constants.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/constants.h new file mode 100644 index 000000000000..f2ba304040ce --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/macros/constants.h @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_CONSTANTS_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_CONSTANTS_H + +// Define a default block size in units of bytes (Note: 64b is a common cache line size. How applicable the common cache line size is here is debatable, given that, depending on the associated stride(s), the innermost loop may not iterate over adjacent elements. The primary goal is to have a block size in which all data within a block can always fit in (L1) cache, regardless of cache size (i.e., cache-oblivious). For reference, a common L1 cache size is 32kB per core. For best performance, block sizes should be tuned based on system hardware; however, such tuning is not readily available to us here. Without obvious better alternatives, 64b has some theoretical (and practical) underpinning, and it should be good enough for most inputs, especially for ndarrays with near contiguity.): +#define STDLIB_NDARRAY_MSKFILTER_BLOCK_SIZE_IN_BYTES 64 + +// Define a default block size in units of elements (Note: 64 bytes / 8 bytes per element; i.e., default element size is same as a double): +#define STDLIB_NDARRAY_MSKFILTER_BLOCK_SIZE_IN_ELEMENTS 8 + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_MACROS_CONSTANTS_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_b.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_b.h new file mode 100644 index 000000000000..1541b96ee911 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_b.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_B_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_B_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_b_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_B_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_c.h new file mode 100644 index 000000000000..30bd8ef54bce --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_d.h new file mode 100644 index 000000000000..d112721bbca8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_f.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_f.h new file mode 100644 index 000000000000..229250d2ad5d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_f.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_F_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_F_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_f_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_F_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_i.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_i.h new file mode 100644 index 000000000000..093d85ba7e55 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_i.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_I_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_I_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_i_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_I_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_k.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_k.h new file mode 100644 index 000000000000..92d31ea4b487 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_k.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_K_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_K_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_k_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_K_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_s.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_s.h new file mode 100644 index 000000000000..58a96cc4a281 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_s.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_S_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_S_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_s_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_S_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_t.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_t.h new file mode 100644 index 000000000000..8c94b989cb6f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_t.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_T_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_T_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_t_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_T_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_u.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_u.h new file mode 100644 index 000000000000..4f7de780ac73 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_u.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_U_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_U_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_u_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_U_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_z.h new file mode 100644 index 000000000000..3c021fd37258 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/s_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_S_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_S_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_s_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_S_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_c.h new file mode 100644 index 000000000000..41f2588dbd0c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_d.h new file mode 100644 index 000000000000..baba1f80d188 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_f.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_f.h new file mode 100644 index 000000000000..819b01f2a2d3 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_f.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_F_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_F_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_f_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_F_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_i.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_i.h new file mode 100644 index 000000000000..d81e73ffed0b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_i.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_I_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_I_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_i_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_I_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_t.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_t.h new file mode 100644 index 000000000000..7854d19f429c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_t.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_T_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_T_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_t_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_T_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_u.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_u.h new file mode 100644 index 000000000000..aabad500a485 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_u.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_U_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_U_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_u_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_U_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_z.h new file mode 100644 index 000000000000..3244c49ec1df --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/t_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_T_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_T_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_t_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_T_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/typedefs.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/typedefs.h new file mode 100644 index 000000000000..afe064502722 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/typedefs.h @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_TYPEDEFS_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_TYPEDEFS_H + +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Function pointer type for a unary ndarray function. +* +* @param arrays array containing pointers to input and output ndarrays +* @return status code +*/ +typedef int8_t (*ndarrayUnaryMskfilterFcn)( struct ndarray *arrays[] ); + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_TYPEDEFS_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_d.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_d.h new file mode 100644 index 000000000000..f73a0a53f33d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_d.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_U_D_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_U_D_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_d_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_U_D_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_u.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_u.h new file mode 100644 index 000000000000..2ab1523e3d8f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_u.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_U_U_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_U_U_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_u_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_U_U_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_z.h new file mode 100644 index 000000000000..db689e19ef96 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/u_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_U_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_U_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_u_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_U_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/x_x.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/x_x.h new file mode 100644 index 000000000000..eb40f0f141c1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/x_x.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_X_X_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_X_X_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_x_x_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_X_X_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/z_c.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/z_c.h new file mode 100644 index 000000000000..760d3fdb8ade --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/z_c.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_Z_C_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_Z_C_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_c_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_Z_C_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/z_z.h b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/z_z.h new file mode 100644 index 000000000000..74d1dd3a66c1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/include/stdlib/ndarray/base/mskfilter/z_z.h @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_Z_Z_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_Z_Z_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_z_z_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_Z_Z_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/0d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/0d.js new file mode 100644 index 000000000000..bc7603f1fd41 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/0d.js @@ -0,0 +1,89 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = []; +* +* // Define the array strides: +* var sx = [ 0 ]; +* var sm = [ 0 ]; +* var sy = [ 0 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 1 ), +* 'shape': [ 1 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter0d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 1.0 ] +*/ +function mskfilter0d( x, mask, y ) { + if ( mask.data[ mask.offset ] ) { + y.data[ y.offset ] = x.data[ x.offset ]; + } +} + + +// EXPORTS // + +module.exports = mskfilter0d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/0d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/0d_accessors.js new file mode 100644 index 000000000000..de16f513ce2e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/0d_accessors.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = []; +* +* // Define the array strides: +* var sx = [ 0 ]; +* var sm = [ 0 ]; +* var sy = [ 0 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 1 ), +* 'shape': [ 1 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter0d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +*/ +function mskfilter0d( x, mask, y ) { + if ( mask.accessors[ 0 ]( mask.data, mask.offset ) ) { + y.accessors[ 1 ]( y.data, y.offset, x.accessors[ 0 ]( x.data, x.offset ) ); + } +} + + +// EXPORTS // + +module.exports = mskfilter0d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d.js new file mode 100644 index 000000000000..dddebe38e7ed --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d.js @@ -0,0 +1,265 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter10d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter10d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dx9; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dm9; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var S7; + var S8; + var S9; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + var i9; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 9 ]; + S1 = sh[ 8 ]; + S2 = sh[ 7 ]; + S3 = sh[ 6 ]; + S4 = sh[ 5 ]; + S5 = sh[ 4 ]; + S6 = sh[ 3 ]; + S7 = sh[ 2 ]; + S8 = sh[ 1 ]; + S9 = sh[ 0 ]; + dx0 = sx[ 9 ]; // offset increment for innermost loop + dx1 = sx[ 8 ] - ( S0*sx[9] ); + dx2 = sx[ 7 ] - ( S1*sx[8] ); + dx3 = sx[ 6 ] - ( S2*sx[7] ); + dx4 = sx[ 5 ] - ( S3*sx[6] ); + dx5 = sx[ 4 ] - ( S4*sx[5] ); + dx6 = sx[ 3 ] - ( S5*sx[4] ); + dx7 = sx[ 2 ] - ( S6*sx[3] ); + dx8 = sx[ 1 ] - ( S7*sx[2] ); + dx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 9 ]; + dm1 = sm[ 8 ] - ( S0*sm[9] ); + dm2 = sm[ 7 ] - ( S1*sm[8] ); + dm3 = sm[ 6 ] - ( S2*sm[7] ); + dm4 = sm[ 5 ] - ( S3*sm[6] ); + dm5 = sm[ 4 ] - ( S4*sm[5] ); + dm6 = sm[ 3 ] - ( S5*sm[4] ); + dm7 = sm[ 2 ] - ( S6*sm[3] ); + dm8 = sm[ 1 ] - ( S7*sm[2] ); + dm9 = sm[ 0 ] - ( S8*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + S7 = sh[ 7 ]; + S8 = sh[ 8 ]; + S9 = sh[ 9 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); + dx7 = sx[ 7 ] - ( S6*sx[6] ); + dx8 = sx[ 8 ] - ( S7*sx[7] ); + dx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + dm7 = sm[ 7 ] - ( S6*sm[6] ); + dm8 = sm[ 8 ] - ( S7*sm[7] ); + dm9 = sm[ 9 ] - ( S8*sm[8] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i9 = 0; i9 < S9; i9++ ) { + for ( i8 = 0; i8 < S8; i8++ ) { + for ( i7 = 0; i7 < S7; i7++ ) { + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } + ix += dx9; + im += dm9; + } +} + + +// EXPORTS // + +module.exports = mskfilter10d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_accessors.js new file mode 100644 index 000000000000..c3b800499299 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_accessors.js @@ -0,0 +1,303 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter10d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter10d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dx9; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dm9; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var S7; + var S8; + var S9; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + var i9; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 9 ]; + S1 = sh[ 8 ]; + S2 = sh[ 7 ]; + S3 = sh[ 6 ]; + S4 = sh[ 5 ]; + S5 = sh[ 4 ]; + S6 = sh[ 3 ]; + S7 = sh[ 2 ]; + S8 = sh[ 1 ]; + S9 = sh[ 0 ]; + dx0 = sx[ 9 ]; // offset increment for innermost loop + dx1 = sx[ 8 ] - ( S0*sx[9] ); + dx2 = sx[ 7 ] - ( S1*sx[8] ); + dx3 = sx[ 6 ] - ( S2*sx[7] ); + dx4 = sx[ 5 ] - ( S3*sx[6] ); + dx5 = sx[ 4 ] - ( S4*sx[5] ); + dx6 = sx[ 3 ] - ( S5*sx[4] ); + dx7 = sx[ 2 ] - ( S6*sx[3] ); + dx8 = sx[ 1 ] - ( S7*sx[2] ); + dx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 9 ]; + dm1 = sm[ 8 ] - ( S0*sm[9] ); + dm2 = sm[ 7 ] - ( S1*sm[8] ); + dm3 = sm[ 6 ] - ( S2*sm[7] ); + dm4 = sm[ 5 ] - ( S3*sm[6] ); + dm5 = sm[ 4 ] - ( S4*sm[5] ); + dm6 = sm[ 3 ] - ( S5*sm[4] ); + dm7 = sm[ 2 ] - ( S6*sm[3] ); + dm8 = sm[ 1 ] - ( S7*sm[2] ); + dm9 = sm[ 0 ] - ( S8*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + S7 = sh[ 7 ]; + S8 = sh[ 8 ]; + S9 = sh[ 9 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); + dx7 = sx[ 7 ] - ( S6*sx[6] ); + dx8 = sx[ 8 ] - ( S7*sx[7] ); + dx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + dm7 = sm[ 7 ] - ( S6*sm[6] ); + dm8 = sm[ 8 ] - ( S7*sm[7] ); + dm9 = sm[ 9 ] - ( S8*sm[8] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i9 = 0; i9 < S9; i9++ ) { + for ( i8 = 0; i8 < S8; i8++ ) { + for ( i7 = 0; i7 < S7; i7++ ) { + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } + ix += dx9; + im += dm9; + } +} + + +// EXPORTS // + +module.exports = mskfilter10d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_blocked.js new file mode 100644 index 000000000000..7f49e4fbcab8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_blocked.js @@ -0,0 +1,380 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter10d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter10d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dx9; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dm9; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var ox7; + var ox8; + var ox9; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var om7; + var om8; + var om9; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var s7; + var s8; + var s9; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + var i9; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var j7; + var j8; + var j9; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j9 = sh[9]; j9 > 0; ) { + if ( j9 < bsize ) { + s9 = j9; + j9 = 0; + } else { + s9 = bsize; + j9 -= bsize; + } + ox9 = ox + ( j9*sx[9] ); + om9 = om + ( j9*sm[9] ); + for ( j8 = sh[8]; j8 > 0; ) { + if ( j8 < bsize ) { + s8 = j8; + j8 = 0; + } else { + s8 = bsize; + j8 -= bsize; + } + dx9 = sx[9] - ( s8*sx[8] ); + dm9 = sm[9] - ( s8*sm[8] ); + ox8 = ox9 + ( j8*sx[8] ); + om8 = om9 + ( j8*sm[8] ); + for ( j7 = sh[7]; j7 > 0; ) { + if ( j7 < bsize ) { + s7 = j7; + j7 = 0; + } else { + s7 = bsize; + j7 -= bsize; + } + dx8 = sx[8] - ( s7*sx[7] ); + dm8 = sm[8] - ( s7*sm[7] ); + ox7 = ox8 + ( j7*sx[7] ); + om7 = om8 + ( j7*sm[7] ); + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + dx7 = sx[7] - ( s6*sx[6] ); + dm7 = sm[7] - ( s6*sm[6] ); + ox6 = ox7 + ( j6*sx[6] ); + om6 = om7 + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i9 = 0; i9 < s9; i9++ ) { + for ( i8 = 0; i8 < s8; i8++ ) { + for ( i7 = 0; i7 < s7; i7++ ) { + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } + ix += dx9; + im += dm9; + } + } + } + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter10d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_blocked_accessors.js new file mode 100644 index 000000000000..d38a2f4f68ca --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/10d_blocked_accessors.js @@ -0,0 +1,418 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter10d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter10d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dx9; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dm9; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var ox7; + var ox8; + var ox9; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var om7; + var om8; + var om9; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var s7; + var s8; + var s9; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + var i9; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var j7; + var j8; + var j9; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j9 = sh[9]; j9 > 0; ) { + if ( j9 < bsize ) { + s9 = j9; + j9 = 0; + } else { + s9 = bsize; + j9 -= bsize; + } + ox9 = ox + ( j9*sx[9] ); + om9 = om + ( j9*sm[9] ); + for ( j8 = sh[8]; j8 > 0; ) { + if ( j8 < bsize ) { + s8 = j8; + j8 = 0; + } else { + s8 = bsize; + j8 -= bsize; + } + dx9 = sx[9] - ( s8*sx[8] ); + dm9 = sm[9] - ( s8*sm[8] ); + ox8 = ox9 + ( j8*sx[8] ); + om8 = om9 + ( j8*sm[8] ); + for ( j7 = sh[7]; j7 > 0; ) { + if ( j7 < bsize ) { + s7 = j7; + j7 = 0; + } else { + s7 = bsize; + j7 -= bsize; + } + dx8 = sx[8] - ( s7*sx[7] ); + dm8 = sm[8] - ( s7*sm[7] ); + ox7 = ox8 + ( j7*sx[7] ); + om7 = om8 + ( j7*sm[7] ); + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + dx7 = sx[7] - ( s6*sx[6] ); + dm7 = sm[7] - ( s6*sm[6] ); + ox6 = ox7 + ( j6*sx[6] ); + om6 = om7 + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i9 = 0; i9 < s9; i9++ ) { + for ( i8 = 0; i8 < s8; i8++ ) { + for ( i7 = 0; i7 < s7; i7++ ) { + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } + ix += dx9; + im += dm9; + } + } + } + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter10d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/1d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/1d.js new file mode 100644 index 000000000000..900f3204f867 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/1d.js @@ -0,0 +1,123 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 5 ]; +* +* // Define the array strides: +* var sx = [ 1 ]; +* var sm = [ 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter1d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter1d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dm0; + var dy0; + var S0; + var ix; + var im; + var iy; + var i0; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + S0 = x.shape[ 0 ]; + dx0 = x.strides[ 0 ]; + dm0 = mask.strides[ 0 ]; + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } +} + + +// EXPORTS // + +module.exports = mskfilter1d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/1d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/1d_accessors.js new file mode 100644 index 000000000000..bab3f3c1dfb1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/1d_accessors.js @@ -0,0 +1,152 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 3 ]; +* +* // Define the array strides: +* var sx = [ 1 ]; +* var sm = [ 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter1d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +*/ +function mskfilter1d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var mget; + var xget; + var yset; + var dx0; + var dm0; + var dy0; + var S0; + var ix; + var im; + var iy; + var i0; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + S0 = x.shape[ 0 ]; + dx0 = x.strides[ 0 ]; + dm0 = mask.strides[ 0 ]; + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } +} + + +// EXPORTS // + +module.exports = mskfilter1d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d.js new file mode 100644 index 000000000000..287c600777ed --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d.js @@ -0,0 +1,151 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* var sm = [ 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter2d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0 ] +*/ +function mskfilter2d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dm0; + var dm1; + var dy0; + var S0; + var S1; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 1 ]; + S1 = sh[ 0 ]; + dx0 = sx[ 1 ]; // offset increment for innermost loop + dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 1 ]; + dm1 = sm[ 0 ] - ( S0*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } +} + + +// EXPORTS // + +module.exports = mskfilter2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_accessors.js new file mode 100644 index 000000000000..2bf4cd5ac5e8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_accessors.js @@ -0,0 +1,180 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* var sm = [ 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter2d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +*/ +function mskfilter2d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dm0; + var dm1; + var dy0; + var S0; + var S1; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 1 ]; + S1 = sh[ 0 ]; + dx0 = sx[ 1 ]; // offset increment for innermost loop + dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 1 ]; + dm1 = sm[ 0 ] - ( S0*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } +} + + +// EXPORTS // + +module.exports = mskfilter2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_blocked.js new file mode 100644 index 000000000000..c8e93d69e048 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_blocked.js @@ -0,0 +1,186 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* var sm = [ 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter2d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0 ] +*/ +function blockedmskfilter2d( x, mask, y ) { + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dm0; + var dm1; + var dy0; + var ox1; + var om1; + var sh; + var s0; + var s1; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var j0; + var j1; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + ox1 = ox + ( j1*sx[1] ); + om1 = om + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_blocked_accessors.js new file mode 100644 index 000000000000..6d3ca125aa93 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/2d_blocked_accessors.js @@ -0,0 +1,215 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* var sm = [ 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter2d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +*/ +function blockedmskfilter2d( x, mask, y ) { + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dm0; + var dm1; + var dy0; + var ox1; + var om1; + var sh; + var s0; + var s1; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var j0; + var j1; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + ox1 = ox + ( j1*sx[1] ); + om1 = om + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d.js new file mode 100644 index 000000000000..26289f1619ce --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d.js @@ -0,0 +1,165 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 2, 1 ]; +* var sm = [ 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter3d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter3d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dm0; + var dm1; + var dm2; + var dy0; + var S0; + var S1; + var S2; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 2 ]; + S1 = sh[ 1 ]; + S2 = sh[ 0 ]; + dx0 = sx[ 2 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[2] ); + dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 2 ]; + dm1 = sm[ 1 ] - ( S0*sm[2] ); + dm2 = sm[ 0 ] - ( S1*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } +} + + +// EXPORTS // + +module.exports = mskfilter3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_accessors.js new file mode 100644 index 000000000000..e34b3cf22e7e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_accessors.js @@ -0,0 +1,203 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2, 1 ]; +* var sm = [ 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter3d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter3d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dm0; + var dm1; + var dm2; + var dy0; + var S0; + var S1; + var S2; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 2 ]; + S1 = sh[ 1 ]; + S2 = sh[ 0 ]; + dx0 = sx[ 2 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[2] ); + dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 2 ]; + dm1 = sm[ 1 ] - ( S0*sm[2] ); + dm2 = sm[ 0 ] - ( S1*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } +} + + +// EXPORTS // + +module.exports = mskfilter3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_blocked.js new file mode 100644 index 000000000000..ff75fb1ca56e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_blocked.js @@ -0,0 +1,212 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 2, 1 ]; +* var sm = [ 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter3d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter3d( x, mask, y ) { + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dm0; + var dm1; + var dm2; + var dy0; + var ox1; + var ox2; + var om1; + var om2; + var sh; + var s0; + var s1; + var s2; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var j0; + var j1; + var j2; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + ox2 = ox + ( j2*sx[2] ); + om2 = om + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_blocked_accessors.js new file mode 100644 index 000000000000..2ec89d9ecb90 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/3d_blocked_accessors.js @@ -0,0 +1,250 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2, 1 ]; +* var sm = [ 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter3d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter3d( x, mask, y ) { + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dm0; + var dm1; + var dm2; + var dy0; + var ox1; + var ox2; + var om1; + var om2; + var sh; + var s0; + var s1; + var s2; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var j0; + var j1; + var j2; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + ox2 = ox + ( j2*sx[2] ); + om2 = om + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d.js new file mode 100644 index 000000000000..bda75a7d4c75 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d.js @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 2, 2, 1 ]; +* var sm = [ 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter4d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter4d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dm0; + var dm1; + var dm2; + var dm3; + var dy0; + var S0; + var S1; + var S2; + var S3; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 3 ]; + S1 = sh[ 2 ]; + S2 = sh[ 1 ]; + S3 = sh[ 0 ]; + dx0 = sx[ 3 ]; // offset increment for innermost loop + dx1 = sx[ 2 ] - ( S0*sx[3] ); + dx2 = sx[ 1 ] - ( S1*sx[2] ); + dx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 3 ]; + dm1 = sm[ 2 ] - ( S0*sm[3] ); + dm2 = sm[ 1 ] - ( S1*sm[2] ); + dm3 = sm[ 0 ] - ( S2*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } +} + + +// EXPORTS // + +module.exports = mskfilter4d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_accessors.js new file mode 100644 index 000000000000..c16a478dd069 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_accessors.js @@ -0,0 +1,217 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter4d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter4d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dm0; + var dm1; + var dm2; + var dm3; + var dy0; + var S0; + var S1; + var S2; + var S3; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 3 ]; + S1 = sh[ 2 ]; + S2 = sh[ 1 ]; + S3 = sh[ 0 ]; + dx0 = sx[ 3 ]; // offset increment for innermost loop + dx1 = sx[ 2 ] - ( S0*sx[3] ); + dx2 = sx[ 1 ] - ( S1*sx[2] ); + dx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 3 ]; + dm1 = sm[ 2 ] - ( S0*sm[3] ); + dm2 = sm[ 1 ] - ( S1*sm[2] ); + dm3 = sm[ 0 ] - ( S2*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } +} + + +// EXPORTS // + +module.exports = mskfilter4d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_blocked.js new file mode 100644 index 000000000000..957537335f04 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_blocked.js @@ -0,0 +1,236 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 2, 2, 1 ]; +* var sm = [ 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter4d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter4d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dm0; + var dm1; + var dm2; + var dm3; + var dy0; + var ox1; + var ox2; + var ox3; + var om1; + var om2; + var om3; + var sh; + var s0; + var s1; + var s2; + var s3; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var j0; + var j1; + var j2; + var j3; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + ox3 = ox + ( j3*sx[3] ); + om3 = om + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter4d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_blocked_accessors.js new file mode 100644 index 000000000000..f2c3fb21769c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/4d_blocked_accessors.js @@ -0,0 +1,274 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter4d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter4d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dm0; + var dm1; + var dm2; + var dm3; + var dy0; + var ox1; + var ox2; + var ox3; + var om1; + var om2; + var om3; + var sh; + var s0; + var s1; + var s2; + var s3; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var j0; + var j1; + var j2; + var j3; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + ox3 = ox + ( j3*sx[3] ); + om3 = om + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter4d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d.js new file mode 100644 index 000000000000..beace95b64d8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d.js @@ -0,0 +1,195 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter5d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter5d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 4 ]; + S1 = sh[ 3 ]; + S2 = sh[ 2 ]; + S3 = sh[ 1 ]; + S4 = sh[ 0 ]; + dx0 = sx[ 4 ]; // offset increment for innermost loop + dx1 = sx[ 3 ] - ( S0*sx[4] ); + dx2 = sx[ 2 ] - ( S1*sx[3] ); + dx3 = sx[ 1 ] - ( S2*sx[2] ); + dx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 4 ]; + dm1 = sm[ 3 ] - ( S0*sm[4] ); + dm2 = sm[ 2 ] - ( S1*sm[3] ); + dm3 = sm[ 1 ] - ( S2*sm[2] ); + dm4 = sm[ 0 ] - ( S3*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } +} + + +// EXPORTS // + +module.exports = mskfilter5d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_accessors.js new file mode 100644 index 000000000000..c7e0ed3f3082 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_accessors.js @@ -0,0 +1,233 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter5d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter5d( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 4 ]; + S1 = sh[ 3 ]; + S2 = sh[ 2 ]; + S3 = sh[ 1 ]; + S4 = sh[ 0 ]; + dx0 = sx[ 4 ]; // offset increment for innermost loop + dx1 = sx[ 3 ] - ( S0*sx[4] ); + dx2 = sx[ 2 ] - ( S1*sx[3] ); + dx3 = sx[ 1 ] - ( S2*sx[2] ); + dx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 4 ]; + dm1 = sm[ 3 ] - ( S0*sm[4] ); + dm2 = sm[ 2 ] - ( S1*sm[3] ); + dm3 = sm[ 1 ] - ( S2*sm[2] ); + dm4 = sm[ 0 ] - ( S3*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } +} + + +// EXPORTS // + +module.exports = mskfilter5d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_blocked.js new file mode 100644 index 000000000000..663cbff0bf91 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_blocked.js @@ -0,0 +1,260 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter5d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter5d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var om1; + var om2; + var om3; + var om4; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var j0; + var j1; + var j2; + var j3; + var j4; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + ox4 = ox + ( j4*sx[4] ); + om4 = om + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter5d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_blocked_accessors.js new file mode 100644 index 000000000000..5e32f52c8440 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/5d_blocked_accessors.js @@ -0,0 +1,298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter5d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter5d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var om1; + var om2; + var om3; + var om4; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var j0; + var j1; + var j2; + var j3; + var j4; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + ox4 = ox + ( j4*sx[4] ); + om4 = om + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter5d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d.js new file mode 100644 index 000000000000..f75f069be090 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d.js @@ -0,0 +1,209 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter6d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter6d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 5 ]; + S1 = sh[ 4 ]; + S2 = sh[ 3 ]; + S3 = sh[ 2 ]; + S4 = sh[ 1 ]; + S5 = sh[ 0 ]; + dx0 = sx[ 5 ]; // offset increment for innermost loop + dx1 = sx[ 4 ] - ( S0*sx[5] ); + dx2 = sx[ 3 ] - ( S1*sx[4] ); + dx3 = sx[ 2 ] - ( S2*sx[3] ); + dx4 = sx[ 1 ] - ( S3*sx[2] ); + dx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 5 ]; + dm1 = sm[ 4 ] - ( S0*sm[5] ); + dm2 = sm[ 3 ] - ( S1*sm[4] ); + dm3 = sm[ 2 ] - ( S2*sm[3] ); + dm4 = sm[ 1 ] - ( S3*sm[2] ); + dm5 = sm[ 0 ] - ( S4*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } +} + + +// EXPORTS // + +module.exports = mskfilter6d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_accessors.js new file mode 100644 index 000000000000..2905c0b399f2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_accessors.js @@ -0,0 +1,247 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter6d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter6d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 5 ]; + S1 = sh[ 4 ]; + S2 = sh[ 3 ]; + S3 = sh[ 2 ]; + S4 = sh[ 1 ]; + S5 = sh[ 0 ]; + dx0 = sx[ 5 ]; // offset increment for innermost loop + dx1 = sx[ 4 ] - ( S0*sx[5] ); + dx2 = sx[ 3 ] - ( S1*sx[4] ); + dx3 = sx[ 2 ] - ( S2*sx[3] ); + dx4 = sx[ 1 ] - ( S3*sx[2] ); + dx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 5 ]; + dm1 = sm[ 4 ] - ( S0*sm[5] ); + dm2 = sm[ 3 ] - ( S1*sm[4] ); + dm3 = sm[ 2 ] - ( S2*sm[3] ); + dm4 = sm[ 1 ] - ( S3*sm[2] ); + dm5 = sm[ 0 ] - ( S4*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } +} + + +// EXPORTS // + +module.exports = mskfilter6d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_blocked.js new file mode 100644 index 000000000000..1c0bbe02601d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_blocked.js @@ -0,0 +1,284 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter6d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter6d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var om1; + var om2; + var om3; + var om4; + var om5; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + ox5 = ox + ( j5*sx[5] ); + om5 = om + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter6d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_blocked_accessors.js new file mode 100644 index 000000000000..3ca905b5c8de --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/6d_blocked_accessors.js @@ -0,0 +1,322 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter6d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter6d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var om1; + var om2; + var om3; + var om4; + var om5; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + ox5 = ox + ( j5*sx[5] ); + om5 = om + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter6d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d.js new file mode 100644 index 000000000000..82f9d0b222a2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d.js @@ -0,0 +1,223 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter7d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter7d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 6 ]; + S1 = sh[ 5 ]; + S2 = sh[ 4 ]; + S3 = sh[ 3 ]; + S4 = sh[ 2 ]; + S5 = sh[ 1 ]; + S6 = sh[ 0 ]; + dx0 = sx[ 6 ]; // offset increment for innermost loop + dx1 = sx[ 5 ] - ( S0*sx[6] ); + dx2 = sx[ 4 ] - ( S1*sx[5] ); + dx3 = sx[ 3 ] - ( S2*sx[4] ); + dx4 = sx[ 2 ] - ( S3*sx[3] ); + dx5 = sx[ 1 ] - ( S4*sx[2] ); + dx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 6 ]; + dm1 = sm[ 5 ] - ( S0*sm[6] ); + dm2 = sm[ 4 ] - ( S1*sm[5] ); + dm3 = sm[ 3 ] - ( S2*sm[4] ); + dm4 = sm[ 2 ] - ( S3*sm[3] ); + dm5 = sm[ 1 ] - ( S4*sm[2] ); + dm6 = sm[ 0 ] - ( S5*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } +} + + +// EXPORTS // + +module.exports = mskfilter7d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_accessors.js new file mode 100644 index 000000000000..7acb8c786c8b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_accessors.js @@ -0,0 +1,261 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter7d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter7d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 6 ]; + S1 = sh[ 5 ]; + S2 = sh[ 4 ]; + S3 = sh[ 3 ]; + S4 = sh[ 2 ]; + S5 = sh[ 1 ]; + S6 = sh[ 0 ]; + dx0 = sx[ 6 ]; // offset increment for innermost loop + dx1 = sx[ 5 ] - ( S0*sx[6] ); + dx2 = sx[ 4 ] - ( S1*sx[5] ); + dx3 = sx[ 3 ] - ( S2*sx[4] ); + dx4 = sx[ 2 ] - ( S3*sx[3] ); + dx5 = sx[ 1 ] - ( S4*sx[2] ); + dx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 6 ]; + dm1 = sm[ 5 ] - ( S0*sm[6] ); + dm2 = sm[ 4 ] - ( S1*sm[5] ); + dm3 = sm[ 3 ] - ( S2*sm[4] ); + dm4 = sm[ 2 ] - ( S3*sm[3] ); + dm5 = sm[ 1 ] - ( S4*sm[2] ); + dm6 = sm[ 0 ] - ( S5*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } +} + + +// EXPORTS // + +module.exports = mskfilter7d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_blocked.js new file mode 100644 index 000000000000..cc62cf6660fc --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_blocked.js @@ -0,0 +1,308 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter7d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter7d( x, mask, y ) { // eslint-disable-line max-statements + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + ox6 = ox + ( j6*sx[6] ); + om6 = om + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter7d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_blocked_accessors.js new file mode 100644 index 000000000000..4f95488f7a77 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/7d_blocked_accessors.js @@ -0,0 +1,346 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter7d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter7d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + ox6 = ox + ( j6*sx[6] ); + om6 = om + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter7d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d.js new file mode 100644 index 000000000000..4ba6ce0c0682 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d.js @@ -0,0 +1,237 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter8d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter8d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var S7; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 7 ]; + S1 = sh[ 6 ]; + S2 = sh[ 5 ]; + S3 = sh[ 4 ]; + S4 = sh[ 3 ]; + S5 = sh[ 2 ]; + S6 = sh[ 1 ]; + S7 = sh[ 0 ]; + dx0 = sx[ 7 ]; // offset increment for innermost loop + dx1 = sx[ 6 ] - ( S0*sx[7] ); + dx2 = sx[ 5 ] - ( S1*sx[6] ); + dx3 = sx[ 4 ] - ( S2*sx[5] ); + dx4 = sx[ 3 ] - ( S3*sx[4] ); + dx5 = sx[ 2 ] - ( S4*sx[3] ); + dx6 = sx[ 1 ] - ( S5*sx[2] ); + dx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 7 ]; + dm1 = sm[ 6 ] - ( S0*sm[7] ); + dm2 = sm[ 5 ] - ( S1*sm[6] ); + dm3 = sm[ 4 ] - ( S2*sm[5] ); + dm4 = sm[ 3 ] - ( S3*sm[4] ); + dm5 = sm[ 2 ] - ( S4*sm[3] ); + dm6 = sm[ 1 ] - ( S5*sm[2] ); + dm7 = sm[ 0 ] - ( S6*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + S7 = sh[ 7 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); + dx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + dm7 = sm[ 7 ] - ( S6*sm[6] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i7 = 0; i7 < S7; i7++ ) { + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } +} + + +// EXPORTS // + +module.exports = mskfilter8d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_accessors.js new file mode 100644 index 000000000000..edb09ce4f38d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_accessors.js @@ -0,0 +1,275 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter8d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter8d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var S7; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 7 ]; + S1 = sh[ 6 ]; + S2 = sh[ 5 ]; + S3 = sh[ 4 ]; + S4 = sh[ 3 ]; + S5 = sh[ 2 ]; + S6 = sh[ 1 ]; + S7 = sh[ 0 ]; + dx0 = sx[ 7 ]; // offset increment for innermost loop + dx1 = sx[ 6 ] - ( S0*sx[7] ); + dx2 = sx[ 5 ] - ( S1*sx[6] ); + dx3 = sx[ 4 ] - ( S2*sx[5] ); + dx4 = sx[ 3 ] - ( S3*sx[4] ); + dx5 = sx[ 2 ] - ( S4*sx[3] ); + dx6 = sx[ 1 ] - ( S5*sx[2] ); + dx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 7 ]; + dm1 = sm[ 6 ] - ( S0*sm[7] ); + dm2 = sm[ 5 ] - ( S1*sm[6] ); + dm3 = sm[ 4 ] - ( S2*sm[5] ); + dm4 = sm[ 3 ] - ( S3*sm[4] ); + dm5 = sm[ 2 ] - ( S4*sm[3] ); + dm6 = sm[ 1 ] - ( S5*sm[2] ); + dm7 = sm[ 0 ] - ( S6*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + S7 = sh[ 7 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); + dx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + dm7 = sm[ 7 ] - ( S6*sm[6] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i7 = 0; i7 < S7; i7++ ) { + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } +} + + +// EXPORTS // + +module.exports = mskfilter8d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_blocked.js new file mode 100644 index 000000000000..fa829e3adddf --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_blocked.js @@ -0,0 +1,332 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter8d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter8d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var ox7; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var om7; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var s7; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var j7; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j7 = sh[7]; j7 > 0; ) { + if ( j7 < bsize ) { + s7 = j7; + j7 = 0; + } else { + s7 = bsize; + j7 -= bsize; + } + ox7 = ox + ( j7*sx[7] ); + om7 = om + ( j7*sm[7] ); + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + dx7 = sx[7] - ( s6*sx[6] ); + dm7 = sm[7] - ( s6*sm[6] ); + ox6 = ox7 + ( j6*sx[6] ); + om6 = om7 + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i7 = 0; i7 < s7; i7++ ) { + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter8d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_blocked_accessors.js new file mode 100644 index 000000000000..6aa23801748b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/8d_blocked_accessors.js @@ -0,0 +1,370 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter8d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter8d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var ox7; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var om7; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var s7; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var j7; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j7 = sh[7]; j7 > 0; ) { + if ( j7 < bsize ) { + s7 = j7; + j7 = 0; + } else { + s7 = bsize; + j7 -= bsize; + } + ox7 = ox + ( j7*sx[7] ); + om7 = om + ( j7*sm[7] ); + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + dx7 = sx[7] - ( s6*sx[6] ); + dm7 = sm[7] - ( s6*sm[6] ); + ox6 = ox7 + ( j6*sx[6] ); + om6 = om7 + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i7 = 0; i7 < s7; i7++ ) { + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter8d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d.js new file mode 100644 index 000000000000..e469439865ad --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d.js @@ -0,0 +1,251 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter9d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter9d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var S7; + var S8; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 8 ]; + S1 = sh[ 7 ]; + S2 = sh[ 6 ]; + S3 = sh[ 5 ]; + S4 = sh[ 4 ]; + S5 = sh[ 3 ]; + S6 = sh[ 2 ]; + S7 = sh[ 1 ]; + S8 = sh[ 0 ]; + dx0 = sx[ 8 ]; // offset increment for innermost loop + dx1 = sx[ 7 ] - ( S0*sx[8] ); + dx2 = sx[ 6 ] - ( S1*sx[7] ); + dx3 = sx[ 5 ] - ( S2*sx[6] ); + dx4 = sx[ 4 ] - ( S3*sx[5] ); + dx5 = sx[ 3 ] - ( S4*sx[4] ); + dx6 = sx[ 2 ] - ( S5*sx[3] ); + dx7 = sx[ 1 ] - ( S6*sx[2] ); + dx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 8 ]; + dm1 = sm[ 7 ] - ( S0*sm[8] ); + dm2 = sm[ 6 ] - ( S1*sm[7] ); + dm3 = sm[ 5 ] - ( S2*sm[6] ); + dm4 = sm[ 4 ] - ( S3*sm[5] ); + dm5 = sm[ 3 ] - ( S4*sm[4] ); + dm6 = sm[ 2 ] - ( S5*sm[3] ); + dm7 = sm[ 1 ] - ( S6*sm[2] ); + dm8 = sm[ 0 ] - ( S7*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + S7 = sh[ 7 ]; + S8 = sh[ 8 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); + dx7 = sx[ 7 ] - ( S6*sx[6] ); + dx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + dm7 = sm[ 7 ] - ( S6*sm[6] ); + dm8 = sm[ 8 ] - ( S7*sm[7] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Iterate over the ndarray dimensions... + for ( i8 = 0; i8 < S8; i8++ ) { + for ( i7 = 0; i7 < S7; i7++ ) { + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } +} + + +// EXPORTS // + +module.exports = mskfilter9d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_accessors.js new file mode 100644 index 000000000000..7860e6d807f3 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_accessors.js @@ -0,0 +1,289 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilter9d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilter9d( x, mask, y ) { // eslint-disable-line max-statements + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dy0; + var S0; + var S1; + var S2; + var S3; + var S4; + var S5; + var S6; + var S7; + var S8; + var sh; + var sm; + var sx; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + + // Extract loop variables: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + sm = mask.strides; + if ( x.order === 'row-major' ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 8 ]; + S1 = sh[ 7 ]; + S2 = sh[ 6 ]; + S3 = sh[ 5 ]; + S4 = sh[ 4 ]; + S5 = sh[ 3 ]; + S6 = sh[ 2 ]; + S7 = sh[ 1 ]; + S8 = sh[ 0 ]; + dx0 = sx[ 8 ]; // offset increment for innermost loop + dx1 = sx[ 7 ] - ( S0*sx[8] ); + dx2 = sx[ 6 ] - ( S1*sx[7] ); + dx3 = sx[ 5 ] - ( S2*sx[6] ); + dx4 = sx[ 4 ] - ( S3*sx[5] ); + dx5 = sx[ 3 ] - ( S4*sx[4] ); + dx6 = sx[ 2 ] - ( S5*sx[3] ); + dx7 = sx[ 1 ] - ( S6*sx[2] ); + dx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop + dm0 = sm[ 8 ]; + dm1 = sm[ 7 ] - ( S0*sm[8] ); + dm2 = sm[ 6 ] - ( S1*sm[7] ); + dm3 = sm[ 5 ] - ( S2*sm[6] ); + dm4 = sm[ 4 ] - ( S3*sm[5] ); + dm5 = sm[ 3 ] - ( S4*sm[4] ); + dm6 = sm[ 2 ] - ( S5*sm[3] ); + dm7 = sm[ 1 ] - ( S6*sm[2] ); + dm8 = sm[ 0 ] - ( S7*sm[1] ); + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + S3 = sh[ 3 ]; + S4 = sh[ 4 ]; + S5 = sh[ 5 ]; + S6 = sh[ 6 ]; + S7 = sh[ 7 ]; + S8 = sh[ 8 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); + dx3 = sx[ 3 ] - ( S2*sx[2] ); + dx4 = sx[ 4 ] - ( S3*sx[3] ); + dx5 = sx[ 5 ] - ( S4*sx[4] ); + dx6 = sx[ 6 ] - ( S5*sx[5] ); + dx7 = sx[ 7 ] - ( S6*sx[6] ); + dx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop + dm0 = sm[ 0 ]; + dm1 = sm[ 1 ] - ( S0*sm[0] ); + dm2 = sm[ 2 ] - ( S1*sm[1] ); + dm3 = sm[ 3 ] - ( S2*sm[2] ); + dm4 = sm[ 4 ] - ( S3*sm[3] ); + dm5 = sm[ 5 ] - ( S4*sm[4] ); + dm6 = sm[ 6 ] - ( S5*sm[5] ); + dm7 = sm[ 7 ] - ( S6*sm[6] ); + dm8 = sm[ 8 ] - ( S7*sm[7] ); + } + dy0 = y.strides[ 0 ]; + + // Set the pointers to the first indexed elements in the respective ndarrays... + ix = x.offset; + im = mask.offset; + iy = y.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over the ndarray dimensions... + for ( i8 = 0; i8 < S8; i8++ ) { + for ( i7 = 0; i7 < S7; i7++ ) { + for ( i6 = 0; i6 < S6; i6++ ) { + for ( i5 = 0; i5 < S5; i5++ ) { + for ( i4 = 0; i4 < S4; i4++ ) { + for ( i3 = 0; i3 < S3; i3++ ) { + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } +} + + +// EXPORTS // + +module.exports = mskfilter9d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_blocked.js new file mode 100644 index 000000000000..0edb70e16ab3 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_blocked.js @@ -0,0 +1,356 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sm = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* blockedmskfilter9d( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function blockedmskfilter9d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var ox7; + var ox8; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var om7; + var om8; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var s7; + var s8; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var j7; + var j8; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Iterate over blocks... + for ( j8 = sh[8]; j8 > 0; ) { + if ( j8 < bsize ) { + s8 = j8; + j8 = 0; + } else { + s8 = bsize; + j8 -= bsize; + } + ox8 = ox + ( j8*sx[8] ); + om8 = om + ( j8*sm[8] ); + for ( j7 = sh[7]; j7 > 0; ) { + if ( j7 < bsize ) { + s7 = j7; + j7 = 0; + } else { + s7 = bsize; + j7 -= bsize; + } + dx8 = sx[8] - ( s7*sx[7] ); + dm8 = sm[8] - ( s7*sm[7] ); + ox7 = ox8 + ( j7*sx[7] ); + om7 = om8 + ( j7*sm[7] ); + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + dx7 = sx[7] - ( s6*sx[6] ); + dm7 = sm[7] - ( s6*sm[6] ); + ox6 = ox7 + ( j6*sx[6] ); + om6 = om7 + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i8 = 0; i8 < s8; i8++ ) { + for ( i7 = 0; i7 < s7; i7++ ) { + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } + } + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter9d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_blocked_accessors.js new file mode 100644 index 000000000000..3fb49fbf5ba6 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/9d_blocked_accessors.js @@ -0,0 +1,394 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-depth, max-len */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sm = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* blockedmskfilter9d( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function blockedmskfilter9d( x, mask, y ) { // eslint-disable-line max-statements, max-lines-per-function + var bsize; + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dx5; + var dx6; + var dx7; + var dx8; + var dm0; + var dm1; + var dm2; + var dm3; + var dm4; + var dm5; + var dm6; + var dm7; + var dm8; + var dy0; + var ox1; + var ox2; + var ox3; + var ox4; + var ox5; + var ox6; + var ox7; + var ox8; + var om1; + var om2; + var om3; + var om4; + var om5; + var om6; + var om7; + var om8; + var sh; + var s0; + var s1; + var s2; + var s3; + var s4; + var s5; + var s6; + var s7; + var s8; + var sx; + var sm; + var ox; + var om; + var ix; + var im; + var iy; + var i0; + var i1; + var i2; + var i3; + var i4; + var i5; + var i6; + var i7; + var i8; + var j0; + var j1; + var j2; + var j3; + var j4; + var j5; + var j6; + var j7; + var j8; + var o; + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides, mask.strides ); + sh = o.sh; + sx = o.sx; + sm = o.sy; + + // Determine the block size: + bsize = blockSize( x.dtype, mask.dtype ); + + // Cache the indices of the first indexed elements in the respective ndarrays... + ox = x.offset; + om = mask.offset; + + // Cache references to the input, mask, and output ndarray buffers... + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache offset increments for the innermost loop... + dx0 = sx[0]; + dm0 = sm[0]; + dy0 = y.strides[0]; + + iy = y.offset; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + // Iterate over blocks... + for ( j8 = sh[8]; j8 > 0; ) { + if ( j8 < bsize ) { + s8 = j8; + j8 = 0; + } else { + s8 = bsize; + j8 -= bsize; + } + ox8 = ox + ( j8*sx[8] ); + om8 = om + ( j8*sm[8] ); + for ( j7 = sh[7]; j7 > 0; ) { + if ( j7 < bsize ) { + s7 = j7; + j7 = 0; + } else { + s7 = bsize; + j7 -= bsize; + } + dx8 = sx[8] - ( s7*sx[7] ); + dm8 = sm[8] - ( s7*sm[7] ); + ox7 = ox8 + ( j7*sx[7] ); + om7 = om8 + ( j7*sm[7] ); + for ( j6 = sh[6]; j6 > 0; ) { + if ( j6 < bsize ) { + s6 = j6; + j6 = 0; + } else { + s6 = bsize; + j6 -= bsize; + } + dx7 = sx[7] - ( s6*sx[6] ); + dm7 = sm[7] - ( s6*sm[6] ); + ox6 = ox7 + ( j6*sx[6] ); + om6 = om7 + ( j6*sm[6] ); + for ( j5 = sh[5]; j5 > 0; ) { + if ( j5 < bsize ) { + s5 = j5; + j5 = 0; + } else { + s5 = bsize; + j5 -= bsize; + } + dx6 = sx[6] - ( s5*sx[5] ); + dm6 = sm[6] - ( s5*sm[5] ); + ox5 = ox6 + ( j5*sx[5] ); + om5 = om6 + ( j5*sm[5] ); + for ( j4 = sh[4]; j4 > 0; ) { + if ( j4 < bsize ) { + s4 = j4; + j4 = 0; + } else { + s4 = bsize; + j4 -= bsize; + } + dx5 = sx[5] - ( s4*sx[4] ); + dm5 = sm[5] - ( s4*sm[4] ); + ox4 = ox5 + ( j4*sx[4] ); + om4 = om5 + ( j4*sm[4] ); + for ( j3 = sh[3]; j3 > 0; ) { + if ( j3 < bsize ) { + s3 = j3; + j3 = 0; + } else { + s3 = bsize; + j3 -= bsize; + } + dx4 = sx[4] - ( s3*sx[3] ); + dm4 = sm[4] - ( s3*sm[3] ); + ox3 = ox4 + ( j3*sx[3] ); + om3 = om4 + ( j3*sm[3] ); + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + dx3 = sx[3] - ( s2*sx[2] ); + dm3 = sm[3] - ( s2*sm[2] ); + ox2 = ox3 + ( j2*sx[2] ); + om2 = om3 + ( j2*sm[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + dm2 = sm[2] - ( s1*sm[1] ); + ox1 = ox2 + ( j1*sx[1] ); + om1 = om2 + ( j1*sm[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute index offsets for the first input and mask ndarray elements in the current block... + ix = ox1 + ( j0*sx[0] ); + im = om1 + ( j0*sm[0] ); + + // Compute loop offset increments... + dx1 = sx[1] - ( s0*sx[0] ); + dm1 = sm[1] - ( s0*sm[0] ); + + // Iterate over the ndarray dimensions... + for ( i8 = 0; i8 < s8; i8++ ) { + for ( i7 = 0; i7 < s7; i7++ ) { + for ( i6 = 0; i6 < s6; i6++ ) { + for ( i5 = 0; i5 < s5; i5++ ) { + for ( i4 = 0; i4 < s4; i4++ ) { + for ( i3 = 0; i3 < s3; i3++ ) { + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy0; + } + ix += dx0; + im += dm0; + } + ix += dx1; + im += dm1; + } + ix += dx2; + im += dm2; + } + ix += dx3; + im += dm3; + } + ix += dx4; + im += dm4; + } + ix += dx5; + im += dm5; + } + ix += dx6; + im += dm6; + } + ix += dx7; + im += dm7; + } + ix += dx8; + im += dm8; + } + } + } + } + } + } + } + } + } + } +} + + +// EXPORTS // + +module.exports = blockedmskfilter9d; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/index.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/index.js new file mode 100644 index 000000000000..69e33b38b8d2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/index.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Apply a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @module @stdlib/ndarray/base/mskfilter +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* var mskfilter = require( '@stdlib/ndarray/base/mskfilter' ); +* +* // Define the shape of the input and mask arrays: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 2, 1 ]; +* var sm = [ 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offsets: +* var ox = 1; +* var om = 0; +* +* // Create the input, mask and output ndarray-like objects: +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* var out = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter( [ x, mask, out ] ); +* +* console.log( out.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/main.js new file mode 100644 index 000000000000..613215da5ede --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/main.js @@ -0,0 +1,362 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, id-length */ + +'use strict'; + +// MODULES // + +var iterationOrder = require( '@stdlib/ndarray/base/iteration-order' ); +var ndarray2object = require( '@stdlib/ndarray/base/ndarraylike2object' ); +var minmaxViewBufferIndex = require( '@stdlib/ndarray/base/minmax-view-buffer-index' ); +var format = require( '@stdlib/string/format' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); +var isBooleanArray = require( '@stdlib/assert/is-booleanarray' ); +var blockedaccessormskfilter2d = require( './2d_blocked_accessors.js' ); +var blockedaccessormskfilter3d = require( './3d_blocked_accessors.js' ); +var blockedaccessormskfilter4d = require( './4d_blocked_accessors.js' ); +var blockedaccessormskfilter5d = require( './5d_blocked_accessors.js' ); +var blockedaccessormskfilter6d = require( './6d_blocked_accessors.js' ); +var blockedaccessormskfilter7d = require( './7d_blocked_accessors.js' ); +var blockedaccessormskfilter8d = require( './8d_blocked_accessors.js' ); +var blockedaccessormskfilter9d = require( './9d_blocked_accessors.js' ); +var blockedaccessormskfilter10d = require( './10d_blocked_accessors.js' ); +var blockedmskfilter2d = require( './2d_blocked.js' ); +var blockedmskfilter3d = require( './3d_blocked.js' ); +var blockedmskfilter4d = require( './4d_blocked.js' ); +var blockedmskfilter5d = require( './5d_blocked.js' ); +var blockedmskfilter6d = require( './6d_blocked.js' ); +var blockedmskfilter7d = require( './7d_blocked.js' ); +var blockedmskfilter8d = require( './8d_blocked.js' ); +var blockedmskfilter9d = require( './9d_blocked.js' ); +var blockedmskfilter10d = require( './10d_blocked.js' ); +var accessormskfilter0d = require( './0d_accessors.js' ); +var accessormskfilter1d = require( './1d_accessors.js' ); +var accessormskfilter2d = require( './2d_accessors.js' ); +var accessormskfilter3d = require( './3d_accessors.js' ); +var accessormskfilter4d = require( './4d_accessors.js' ); +var accessormskfilter5d = require( './5d_accessors.js' ); +var accessormskfilter6d = require( './6d_accessors.js' ); +var accessormskfilter7d = require( './7d_accessors.js' ); +var accessormskfilter8d = require( './8d_accessors.js' ); +var accessormskfilter9d = require( './9d_accessors.js' ); +var accessormskfilter10d = require( './10d_accessors.js' ); +var accessormskfilternd = require( './nd_accessors.js' ); +var mskfilter0d = require( './0d.js' ); +var mskfilter1d = require( './1d.js' ); +var mskfilter2d = require( './2d.js' ); +var mskfilter3d = require( './3d.js' ); +var mskfilter4d = require( './4d.js' ); +var mskfilter5d = require( './5d.js' ); +var mskfilter6d = require( './6d.js' ); +var mskfilter7d = require( './7d.js' ); +var mskfilter8d = require( './8d.js' ); +var mskfilter9d = require( './9d.js' ); +var mskfilter10d = require( './10d.js' ); +var mskfilternd = require( './nd.js' ); + + +// VARIABLES // + +var MSKFILTER = [ + mskfilter0d, + mskfilter1d, + mskfilter2d, + mskfilter3d, + mskfilter4d, + mskfilter5d, + mskfilter6d, + mskfilter7d, + mskfilter8d, + mskfilter9d, + mskfilter10d +]; + +var ACCESSOR_MSKFILTER = [ + accessormskfilter0d, + accessormskfilter1d, + accessormskfilter2d, + accessormskfilter3d, + accessormskfilter4d, + accessormskfilter5d, + accessormskfilter6d, + accessormskfilter7d, + accessormskfilter8d, + accessormskfilter9d, + accessormskfilter10d +]; + +var BLOCKED_MSKFILTER = [ + blockedmskfilter2d, + blockedmskfilter3d, + blockedmskfilter4d, + blockedmskfilter5d, + blockedmskfilter6d, + blockedmskfilter7d, + blockedmskfilter8d, + blockedmskfilter9d, + blockedmskfilter10d +]; + +var BLOCKED_ACCESSOR_MSKFILTER = [ + blockedaccessormskfilter2d, + blockedaccessormskfilter3d, + blockedaccessormskfilter4d, + blockedaccessormskfilter5d, + blockedaccessormskfilter6d, + blockedaccessormskfilter7d, + blockedaccessormskfilter8d, + blockedaccessormskfilter9d, + blockedaccessormskfilter10d +]; + +var MAX_DIMS = MSKFILTER.length - 1; + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - Each provided ndarray should be an `object` with the following properties: +* +* - **dtype**: data type. +* - **data**: data buffer. +* - **shape**: dimensions. +* - **strides**: stride lengths. +* - **offset**: index offset. +* - **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style). +* +* @param {ArrayLikeObject} arrays - array-like object containing input array, mask array and output array +* @throws {Error} input and mask arrays must have the same shape +* @throws {Error} output array must have the one dimensional shape +* @throws {Error} input and output arrays must have the same data type +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the input and mask arrays: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 2, 1 ]; +* var sm = [ 2, 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offsets: +* var ox = 1; +* var om = 0; +* +* // Create the input, mask and output ndarray-like objects: +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* var out = { +* 'dtype': 'float64', +* 'data': new Float64Array( 3 ), +* 'shape': [ 3 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilter( [ x, mask, out ] ); +* +* console.log( out.data ); +* // => [ 2.0, 4.0, 6.0 ] +*/ +function mskfilter( arrays ) { + var ndims; + var xmmv; + var mmmv; + var mask; + var shm; + var shx; + var iox; + var iom; + var len; + var ox; + var om; + var sx; + var sm; + var ns; + var d; + var x; + var y; + var i; + + // Unpack the ndarrays and standardize ndarray meta data: + x = ndarray2object( arrays[ 0 ] ); + if ( isBooleanArray( arrays[ 1 ] ) ) { + mask = ndarray2object( reinterpretBoolean( arrays[ 1 ], 0 ) ); + } else { + mask = ndarray2object( arrays[ 1 ] ); + } + y = ndarray2object( arrays[ 2 ] ); + + // Verify that the input and mask arrays have the same number of dimensions... + shx = x.shape; + shm = mask.shape; + ndims = shx.length; + if ( ndims !== shm.length ) { + throw new Error( format( 'invalid arguments. Arrays must have the same number of dimensions (i.e., same rank). ndims(x) == %s. ndims(mask) == %s', ndims, shm.length ) ); + } + + // Verify that the input and mask arrays have the same shape... + ns = 0; + for ( i = 0; i < ndims; i++ ) { + d = shx[i]; + if ( d !== shm[ i ] ) { + throw new Error( format( 'invalid arguments. Arrays must have the same shape. shape(x)[%s] == %s. shape(mask)[%s] == %s', i, d, i, shm[ i ] ) ); + } + // Check whether the current dimension is a singleton dimension... + if ( d === 1 ) { + ns += 1; + } + } + + // Verify that the output array has a one-dimensional shape... + if ( y.shape.length !== 1 ) { + throw new Error( 'invalid argument. Output array must have a one-dimensional shape. ndims(y) == %s', y.shape.length ); + } + + // Determine whether we can avoid iteration altogether... + if ( ndims === 0 ) { + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return ACCESSOR_MSKFILTER[ ndims ]( x, mask, y ); + } + return MSKFILTER[ ndims ]( x, mask, y ); + } + + // Check whether we were provided an empty input ndarray... + len = numel( shx ); + if ( len === 0 ) { + return; + } + + // Determine whether the ndarrays are one-dimensional and thus readily translate to one-dimensional strided arrays... + if ( ndims === 1 ) { + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return ACCESSOR_MSKFILTER[ ndims ]( x, mask, y ); + } + return MSKFILTER[ ndims ]( x, mask, y ); + } + sx = x.strides; + sm = mask.strides; + + // Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays... + if ( ns === ndims-1 ) { + // Get the index of the non-singleton dimension... + for ( i = 0; i < ndims; i++ ) { + if ( shx[ i ] !== 1 ) { + break; + } + } + x.shape = [ shx[i] ]; + mask.shape = x.shape; + x.strides = [ sx[i] ]; + mask.strides = [ sm[i] ]; + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return ACCESSOR_MSKFILTER[ 1 ]( x, mask, y ); + } + return MSKFILTER[ 1 ]( x, mask, y ); + } + iox = iterationOrder( sx ); // +/-1 + iom = iterationOrder( sm ); // +/-1 + + // Determine whether we can avoid blocked iteration... + if ( iox !== 0 && iom !== 0 && x.order === mask.order ) { + // Determine the minimum and maximum linear indices which are accessible by the array views: + xmmv = minmaxViewBufferIndex( shx, sx, x.offset ); + mmmv = minmaxViewBufferIndex( shm, sm, mask.offset ); + + // Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays... + if ( len === ( xmmv[1]-xmmv[0]+1 ) && len === ( mmmv[1]-mmmv[0]+1 ) ) { + // Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values... + if ( iox === 1 ) { + ox = xmmv[ 0 ]; + } else { + ox = xmmv[ 1 ]; + } + if ( iom === 1 ) { + om = mmmv[ 0 ]; + } else { + om = mmmv[ 1 ]; + } + x.shape = [ len ]; + mask.shape = x.shape; + x.strides = [ iox ]; + mask.strides = [ iom ]; + x.offset = ox; + mask.offset = om; + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return ACCESSOR_MSKFILTER[ 1 ]( x, mask, y ); + } + return MSKFILTER[ 1 ]( x, mask, y ); + } + // At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality... + + // Determine whether we can use simple nested loops... + if ( ndims <= MAX_DIMS ) { + // So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration... + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return ACCESSOR_MSKFILTER[ ndims ]( x, mask, y ); + } + return MSKFILTER[ ndims ]( x, mask, y ); + } + // Fall-through to blocked iteration... + } + // At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration... + + // Determine whether we can perform blocked iteration... + if ( ndims <= MAX_DIMS ) { + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return BLOCKED_ACCESSOR_MSKFILTER[ ndims-2 ]( x, mask, y ); + } + return BLOCKED_MSKFILTER[ ndims-2 ]( x, mask, y ); + } + // Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)... + if ( x.accessorProtocol || mask.accessorProtocol || y.accessorProtocol ) { + return accessormskfilternd( x, mask, y ); + } + mskfilternd( x, mask, y ); +} + + +// EXPORTS // + +module.exports = mskfilter; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/nd.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/nd.js new file mode 100644 index 000000000000..644c0be262d5 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/nd.js @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var numel = require( '@stdlib/ndarray/base/numel' ); +var vind2bind = require( '@stdlib/ndarray/base/vind2bind' ); + + +// VARIABLES // + +var MODE = 'throw'; + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Uint8Array = require( '@stdlib/array/uint8' ); +* +* // Define the shape of the array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* var sm = [ 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 1; +* var om = 0; +* +* var x = { +* 'dtype': 'float64', +* 'data': new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* var mask = { +* 'dtype': 'uint8', +* 'data': new Uint8Array( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major' +* }; +* +* var y = { +* 'dtype': 'float64', +* 'data': new Float64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major' +* }; +* +* mskfilternd( x, mask, y ); +* +* console.log( y.data ); +* // => [ 2.0, 4.0 ] +*/ +function mskfilternd( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var ordx; + var ordm; + var len; + var sh; + var sx; + var sm; + var dy; + var ox; + var om; + var oy; + var ix; + var im; + var iy; + var i; + + sh = x.shape; + + // Compute the total number of elements over which to iterate: + len = numel( sh ); + + // Cache references to the input, mask and output ndarray data buffers: + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache references to the respective stride arrays: + sx = x.strides; + sm = mask.strides; + dy = y.strides[ 0 ]; + + // Cache the indices of the first indexed elements in the respective ndarrays: + ox = x.offset; + om = mask.offset; + oy = y.offset; + + // Cache the respective array orders: + ordx = x.order; + ordm = mask.order; + + iy = oy; + + // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... + for ( i = 0; i < len; i++ ) { + ix = vind2bind( sh, sx, ox, ordx, i, MODE ); + im = vind2bind( sh, sm, om, ordm, i, MODE ); + if ( mbuf[ im ] ) { + ybuf[ iy ] = xbuf[ ix ]; + iy += dy; + } + } +} + + +// EXPORTS // + +module.exports = mskfilternd; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/nd_accessors.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/nd_accessors.js new file mode 100644 index 000000000000..abb17ad226ae --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/lib/nd_accessors.js @@ -0,0 +1,188 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var numel = require( '@stdlib/ndarray/base/numel' ); +var vind2bind = require( '@stdlib/ndarray/base/vind2bind' ); + + +// VARIABLES // + +var MODE = 'throw'; + + +// MAIN // + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* @private +* @param {Object} x - object containing input ndarray meta data +* @param {Object} mask - object containing mask ndarray meta data +* @param {Object} y - object containing output ndarray meta data +* @returns {void} +* +* @example +* var BooleanArray = require( '@stdlib/array/bool' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* // Define the shape of the array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* var sm = [ 2, 1 ]; +* var sy = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* var om = 0; +* +* // Define getters and setters: +* function getter( buf, idx ) { +* return buf.get( idx ); +* } +* +* function setter( buf, idx, value ) { +* buf.set( value, idx ); +* } +* +* var x = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var mask = { +* 'dtype': 'bool', +* 'data': new BooleanArray( [ 1, 0, 1, 0 ] ), +* 'shape': shape, +* 'strides': sm, +* 'offset': om, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'dtype': 'complex64', +* 'data': new Complex64Array( 2 ), +* 'shape': [ 2 ], +* 'strides': sy, +* 'offset': 0, +* 'order': 'row-major', +* 'accessors': [ getter, setter ] +* }; +* +* mskfilternd( x, mask, y ); +* +* var v = y.data.get( 0 ); +* // returns +* +* var re = realf( v ); +* // returns 1.0 +* +* var im = imagf( v ); +* // returns 2.0 +* +* v = y.data.get( 1 ); +* // returns +* +* re = realf( v ); +* // returns 5.0 +* +* im = imagf( v ); +* // returns 6.0 +*/ +function mskfilternd( x, mask, y ) { + var xbuf; + var mbuf; + var ybuf; + var xget; + var mget; + var yset; + var ordx; + var ordm; + var len; + var sh; + var sx; + var sm; + var dy; + var ox; + var om; + var oy; + var ix; + var im; + var iy; + var i; + + sh = x.shape; + + // Compute the total number of elements over which to iterate: + len = numel( sh ); + + // Cache references to the input, mask and output ndarray data buffers: + xbuf = x.data; + mbuf = mask.data; + ybuf = y.data; + + // Cache references to the respective stride arrays: + sx = x.strides; + sm = mask.strides; + dy = y.strides[ 0 ]; + + // Cache the indices of the first indexed elements in the respective ndarrays: + ox = x.offset; + om = mask.offset; + oy = y.offset; + + // Cache the respective array orders: + ordx = x.order; + ordm = mask.order; + + // Cache accessors: + xget = x.accessors[ 0 ]; + mget = mask.accessors[ 0 ]; + yset = y.accessors[ 1 ]; + + iy = oy; + + // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... + for ( i = 0; i < len; i++ ) { + ix = vind2bind( sh, sx, ox, ordx, i, MODE ); + im = vind2bind( sh, sm, om, ordm, i, MODE ); + if ( mget( mbuf, im ) ) { + yset( ybuf, iy, xget( xbuf, ix ) ); + iy += dy; + } + } +} + + +// EXPORTS // + +module.exports = mskfilternd; diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/manifest.json b/lib/node_modules/@stdlib/ndarray/base/mskfilter/manifest.json new file mode 100644 index 000000000000..20bbf536535a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/manifest.json @@ -0,0 +1,100 @@ +{ + "options": {}, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "src": [ + "./src/b_b.c", + "./src/b_c.c", + "./src/b_d.c", + "./src/b_f.c", + "./src/b_i.c", + "./src/b_k.c", + "./src/b_t.c", + "./src/b_u.c", + "./src/b_z.c", + "./src/c_c.c", + "./src/c_z.c", + "./src/d_c.c", + "./src/d_d.c", + "./src/d_f.c", + "./src/d_z.c", + "./src/f_c.c", + "./src/f_d.c", + "./src/f_f.c", + "./src/f_z.c", + "./src/i_d.c", + "./src/i_i.c", + "./src/i_u.c", + "./src/i_z.c", + "./src/k_c.c", + "./src/k_d.c", + "./src/k_f.c", + "./src/k_i.c", + "./src/k_k.c", + "./src/k_t.c", + "./src/k_u.c", + "./src/k_z.c", + "./src/s_b.c", + "./src/s_c.c", + "./src/s_d.c", + "./src/s_f.c", + "./src/s_i.c", + "./src/s_k.c", + "./src/s_s.c", + "./src/s_t.c", + "./src/s_u.c", + "./src/s_z.c", + "./src/t_c.c", + "./src/t_d.c", + "./src/t_f.c", + "./src/t_i.c", + "./src/t_t.c", + "./src/t_u.c", + "./src/t_z.c", + "./src/u_d.c", + "./src/u_u.c", + "./src/u_z.c", + "./src/x_x.c", + "./src/z_c.c", + "./src/z_z.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float64/ctor", + "@stdlib/ndarray/base/bytes-per-element", + "@stdlib/ndarray/base/iteration-order", + "@stdlib/ndarray/base/vind2bind", + "@stdlib/ndarray/ctor", + "@stdlib/ndarray/index-modes", + "@stdlib/ndarray/orders" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/package.json b/lib/node_modules/@stdlib/ndarray/base/mskfilter/package.json new file mode 100644 index 000000000000..fa72dc5a5c3c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/ndarray/base/mskfilter", + "version": "0.0.0", + "description": "Apply a mask to a provided input ndarray and assign unmasked values to elements in a provided one-dimensional output ndarray.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "scripts": "./scripts", + "src": "./src", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "base", + "strided", + "array", + "ndarray", + "mskfilter" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/loops.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/loops.js new file mode 100644 index 000000000000..2c16efada3e8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/loops.js @@ -0,0 +1,842 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-lines, @cspell/spellchecker */ + +'use strict'; + +// MODULES // + +var path = require( 'path' ); +var logger = require( 'debug' ); +var readDir = require( '@stdlib/fs/read-dir' ).sync; +var unlink = require( '@stdlib/fs/unlink' ).sync; +var readFile = require( '@stdlib/fs/read-file' ).sync; +var readJSON = require( '@stdlib/fs/read-json' ).sync; +var writeFile = require( '@stdlib/fs/write-file' ).sync; +var replace = require( '@stdlib/string/replace' ); +var substringBefore = require( '@stdlib/string/substring-before' ); +var substringAfter = require( '@stdlib/string/substring-after' ); +var uppercase = require( '@stdlib/string/uppercase' ); +var dtypes = require( '@stdlib/ndarray/dtypes' ); +var mostlySafeCasts = require( '@stdlib/ndarray/mostly-safe-casts' ); +var dtypeChar = require( '@stdlib/ndarray/base/dtype-char' ); +var dtypeDesc = require( '@stdlib/ndarray/base/dtype-desc' ); +var dtype2c = require( '@stdlib/ndarray/base/dtype2c' ); +var char2dtype = require( '@stdlib/ndarray/base/char2dtype' ); +var bytesPerElement = require( '@stdlib/ndarray/base/bytes-per-element' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var gscal = require( '@stdlib/blas/base/gscal' ); +var filledarray = require( '@stdlib/array/filled' ); +var currentYear = require( '@stdlib/time/current-year' ); +var format = require( '@stdlib/string/format' ); + + +// VARIABLES // + +var FOPTS = { + 'encoding': 'utf8' +}; + +// Logger: +var debug = logger( 'ndarray-mskfilter-loops:script' ); + +// Get the current year: +var CURRENT_YEAR = currentYear().toString(); + +// Specify the copyright holder: +var COPYRIGHT = 'The Stdlib Authors'; + +// Templates: +var TMPL_HEADER = readFile( path.join( __dirname, 'templates', 'header.txt' ), FOPTS ); +var TMPL_SOURCE = readFile( path.join( __dirname, 'templates', 'source.txt' ), FOPTS ); +var TMPL_README = readFile( path.join( __dirname, 'templates', 'docs.txt' ), FOPTS ); + +// Output directories: +var INCLUDE_DIR = path.resolve( __dirname, '..', 'include', 'stdlib', 'ndarray', 'base', 'mskfilter' ); +var SRC_DIR = path.resolve( __dirname, '..', 'src' ); + +// Main header file: +var INCLUDE_MAIN = INCLUDE_DIR + '.h'; + +// Manifest file: +var MANIFEST = path.resolve( __dirname, '..', 'manifest.json' ); + +// README file: +var README = path.resolve( __dirname, '..', 'README.md' ); + +// Data types to exclude when generating loops: +var EXCLUDE_DTYPES = [ 'binary', 'generic', 'uint8c' ]; + +// Resolve a list of dtypes for which we want to create loops: +var DTYPES = filter( dtypes(), EXCLUDE_DTYPES ); + +// Define "special" loops, which cannot be readily generated according to standardized rules: +var SPECIAL_LOOPS = [ + // Support callbacks which operate on signed integers, but whose return values are always positive and can be cast to unsigned integers of the same or greater bit width: + 'i_u', + 'k_t', + 'k_u', + 's_b', + 's_t', + 's_u' +]; + +// Hash containing C macro names: +var MACROS = { + 'nocast': 'NOCAST', + 'cast': 'CAST', + 'fcast': 'CAST_FCN' +}; + +// Regular expression to test for a "loop" file: +var RE_LOOP_FILE = /^[a-z]_[a-z]\.(?:h|c)$/; + +// Regular expression to test for a "loop" file in the manifest.json: +var RE_MANIFEST_LOOP_FILE = /\.\/src\/[a-z]_[a-z]\.c$/; + +// Regular expression to match input and output array dtype characters: +var RE_SIGNATURE = /^([a-z])_([a-z])/; + +// Specify array INPUT_SHAPES: +var INPUT_SHAPES = [ + [], + [ 3 ], + [ 2, 2 ], + [ 2, 2, 2 ], + [ 1, 2, 2, 2 ], + [ 1, 1, 2, 2, 2 ], + [ 1, 1, 1, 2, 2, 2 ], + [ 1, 1, 1, 1, 2, 2, 2 ], + [ 1, 1, 1, 1, 1, 2, 2, 2 ], + [ 1, 1, 1, 1, 1, 1, 2, 2, 2 ], + [ 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 ] +]; + +var OUTPUT_SHAPES = [ + [], + [ 3 ], + [ 4 ], + [ 8 ], + [ 8 ], + [ 8 ], + [ 8 ], + [ 8 ], + [ 8 ], + [ 8 ], + [ 8 ] +]; + +// Array order: +var ORDER = 'row-major'; + + +// FUNCTIONS // + +/** +* Removes a list of elements from a provided list. +* +* @private +* @param {ArrayLikeObject} src - list to filter +* @param {ArrayLikeObject} list - items to remove +* @returns {Array} filtered list +* +* @example +* var src = [ 'a', 'b', 'c', 'd' ]; +* var list = [ 'b', 'd' ]; +* +* var out = filter( src, list ); +* // returns [ 'a', 'c' ] +*/ +function filter( src, list ) { + var out; + var M; + var N; + var v; + var i; + var j; + + M = src.length; + N = list.length; + + out = []; + for ( i = 0; i < M; i++ ) { + v = src[ i ]; + for ( j = 0; j < N; j++ ) { + if ( v === list[ j ] ) { + break; + } + } + if ( j === N ) { + out.push( v ); + } + } + return out; +} + +/** +* Removes loop files from a directory. +* +* @private +* @param {string} dir - directory +*/ +function removeLoopFiles( dir ) { + var list; + var i; + + list = readDir( dir ); + for ( i = 0; i < list.length; i++ ) { + if ( RE_LOOP_FILE.test( list[ i ] ) ) { + unlink( path.join( dir, list[ i ] ) ); + } + } +} + +/** +* Generates a list of loop signatures from a list of data types. +* +* @private +* @param {StringArray} dtypes - list of data types +* @returns {StringArray} list of loop signatures +*/ +function signatures( dtypes ) { + var casts; + var out; + var ch1; + var ch2; + var t1; + var t2; + var N; + var s; + var i; + var j; + + N = dtypes.length; + + // Generate the list of signatures: + out = []; + for ( i = 0; i < N; i++ ) { + t1 = dtypes[ i ]; + + // Resolve single-letter dtype abbreviation: + ch1 = dtypeChar( t1 ); + + // Generate the input/output array signature: + s = ch1+'_'+ch1; // e.g., d_d + out.push( s ); + + // Resolve the list of (mostly) safe casts for the input dtype: + casts = mostlySafeCasts( t1 ); + + // Remove the excluded dtypes: + casts = filter( casts, EXCLUDE_DTYPES ); + + // Generate signatures for allowed casts: + for ( j = 0; j < casts.length; j++ ) { + t2 = casts[ j ]; + if ( t2 === t1 ) { + continue; + } + ch2 = dtypeChar( t2 ); + s = ch1+'_'+ch2; + + out.push( s ); // e.g., `b_i` + } + } + // Append any special loops: + for ( i = 0; i < SPECIAL_LOOPS.length; i++ ) { + out.push( SPECIAL_LOOPS[ i ] ); + } + return out.sort(); +} + +/** +* Defines byte arrays in a provided template string. +* +* @private +* @param {string} tmpl - template string +* @param {PositiveInteger} nb1 - bytes per element for input array +* @param {PositiveInteger} nb2 - bytes per element for mask array +* @param {PositiveInteger} nb3 - bytes per element for output array +* @returns {string} updated string +*/ +function defineByteArrays( tmpl, nb1, nb2, nb3 ) { + var bytes; + var tmp; + var N; + var i; + + bytes = filledarray( 0, nb1, 'generic' ).join( ', ' ); + tmpl = replace( tmpl, '{{INPUT_NDARRAY_1_BYTES_0D}}', bytes ); + + bytes = filledarray( 0, nb2, 'generic' ).join( ', ' ); + tmpl = replace( tmpl, '{{INPUT_NDARRAY_2_BYTES_0D}}', bytes ); + + bytes = filledarray( 0, nb3, 'generic' ).join( ', ' ); + tmpl = replace( tmpl, '{{OUTPUT_NDARRAY_BYTES_0D}}', bytes ); + + for ( i = 1; i < INPUT_SHAPES.length; i++ ) { + N = numel( INPUT_SHAPES[ i ] ); + + tmp = '{{INPUT_NDARRAY_1_BYTES_'+i+'D}}'; + bytes = filledarray( 0, nb1*N, 'generic' ).join( ', ' ); + tmpl = replace( tmpl, tmp, bytes ); + + tmp = '{{INPUT_NDARRAY_2_BYTES_'+i+'D}}'; + bytes = filledarray( 0, nb2*N, 'generic' ).join( ', ' ); + tmpl = replace( tmpl, tmp, bytes ); + + tmp = '{{OUTPUT_NDARRAY_BYTES_'+i+'D}}'; + bytes = filledarray( 0, nb3*N, 'generic' ).join( ', ' ); + tmpl = replace( tmpl, tmp, bytes ); + } + return tmpl; +} + +/** +* Defines array strides in a provided template string. +* +* @private +* @param {string} tmpl - template string +* @param {PositiveInteger} nb1 - bytes per element for input array +* @param {PositiveInteger} nb2 - bytes per element for mask array +* @param {PositiveInteger} nb3 - bytes per element for output array +* @returns {string} updated string +*/ +function defineStrides( tmpl, nb1, nb2, nb3 ) { + var strides; + var tmp; + var st; + var i; + + for ( i = 1; i < INPUT_SHAPES.length; i++ ) { + strides = shape2strides( INPUT_SHAPES[ i ], ORDER ); + + tmp = '{{INPUT_NDARRAY_1_STRIDES_'+i+'D}}'; + st = gscal( strides.length, nb1, strides.slice(), 1 ); + tmpl = replace( tmpl, tmp, st.join( ', ' ) ); + + tmp = '{{INPUT_NDARRAY_2_STRIDES_'+i+'D}}'; + st = gscal( strides.length, nb2, strides.slice(), 1 ); + tmpl = replace( tmpl, tmp, st.join( ', ' ) ); + + strides = shape2strides( OUTPUT_SHAPES[ i ], ORDER ); + + tmp = '{{OUTPUT_NDARRAY_STRIDES_'+i+'D}}'; + st = gscal( strides.length, nb3, strides.slice(), 1 ); + tmpl = replace( tmpl, tmp, st.join( ', ' ) ); + } + return tmpl; +} + +/** +* Defines array INPUT_SHAPES in a provided template string. +* +* @private +* @param {string} tmpl - template string +* @returns {string} updated string +*/ +function defineShapes( tmpl ) { + var i; + for ( i = 1; i < INPUT_SHAPES.length; i++ ) { + tmpl = replace( tmpl, '{{INPUT_NDARRAY_SHAPE_'+i+'D}}', INPUT_SHAPES[ i ].join( ', ' ) ); + tmpl = replace( tmpl, '{{OUTPUT_NDARRAY_SHAPE_'+i+'D}}', OUTPUT_SHAPES[ i ].join( ', ' ) ); + } + return tmpl; +} + +/** +* Creates a header file for a provided loop signature. +* +* @private +* @param {string} signature - loop signature +* @throws {Error} unexpected error +*/ +function createHeaderFile( signature ) { + var fpath; + var file; + var err; + + file = replace( TMPL_HEADER, '{{YEAR}}', CURRENT_YEAR ); + file = replace( file, '{{COPYRIGHT}}', COPYRIGHT ); + file = replace( file, '{{INCLUDE_GUARD}}', uppercase( signature ) ); + file = replace( file, '{{SIGNATURE}}', signature ); + + fpath = path.join( INCLUDE_DIR, signature+'.h' ); + + debug( 'Creating header file: %s', fpath ); + err = writeFile( fpath, file, FOPTS ); + if ( err ) { + throw err; + } +} + +/** +* Creates header files for a list of loop signatures. +* +* @private +* @param {StringArray} signatures - list of loop signatures +*/ +function createHeaderFiles( signatures ) { + var i; + for ( i = 0; i < signatures.length; i++ ) { + createHeaderFile( signatures[ i ] ); + } +} + +/** +* Creates a source file for a provided loop signature. +* +* @private +* @param {string} signature - loop signature +* @throws {Error} unexpected error +*/ +function createSourceFile( signature ) { + var match1; + var macro; + var fpath; + var file; + var args; + var err; + var inc; + var tmp; + var ch1; + var ch2; + var ct1; + var ct2; + var nb1; + var nb2; + var nb3; + var t1; + var t2; + var t3; + + file = replace( TMPL_SOURCE, '{{YEAR}}', CURRENT_YEAR ); + file = replace( file, '{{COPYRIGHT}}', COPYRIGHT ); + file = replace( file, '{{SIGNATURE}}', signature ); + + // Ensure the appropriate header files are included in source files: + inc = []; + if ( /c/.test( signature ) ) { + inc.push( '#include "stdlib/complex/float32/ctor.h"' ); + } + if ( /z/.test( signature ) ) { + inc.push( '#include "stdlib/complex/float64/ctor.h"' ); + } + if ( /x/.test( signature ) ) { + inc.push( '#include ' ); + } + if ( inc.length ) { + file = replace( file, '{{INCLUDES}}', '\n'+inc.join( '\n' ) ); + } else { + file = replace( file, '{{INCLUDES}}', '' ); + } + // Ensure the appropriate header files are included in source documentation examples: + file = replace( file, '{{EXAMPLE_INCLUDES}}', '' ); + + // Resolve the array data types: + match1 = signature.match( RE_SIGNATURE ); + t2 = 'uint8'; + ch1 = match1[ 1 ]; + t1 = char2dtype( ch1 ); + ch2 = match1[ 2 ]; + t3 = char2dtype( ch2 ); + + // Define array data types: + file = replace( file, '{{INPUT_NDARRAY_1_DTYPE_UPPER}}', uppercase( t1 ) ); + file = replace( file, '{{OUTPUT_NDARRAY_DTYPE_UPPER}}', uppercase( t3 ) ); + + file = replace( file, '{{INPUT_NDARRAY_1_DTYPE_LOWER}}', t1 ); + file = replace( file, '{{OUTPUT_NDARRAY_DTYPE_LOWER}}', t3 ); + + // Define the number of bytes per element for the respective arrays: + nb1 = bytesPerElement( t1 ); + file = replace( file, '{{INPUT_NDARRAY_1_BYTES_PER_ELEMENT}}', nb1.toString() ); + + nb2 = bytesPerElement( t2 ); + file = replace( file, '{{INPUT_NDARRAY_2_BYTES_PER_ELEMENT}}', nb2.toString() ); + + nb3 = bytesPerElement( t3 ); + file = replace( file, '{{OUTPUT_NDARRAY_BYTES_PER_ELEMENT}}', nb3.toString() ); + + // Define the array INPUT_SHAPES: + file = defineShapes( file ); + + // Define underlying byte arrays: + file = defineByteArrays( file, nb1, nb2, nb3 ); + + // Define array strides: + file = defineStrides( file, nb1, nb2, nb3 ); + + // Resolve C data types: + ct1 = dtype2c( t1 ); + ct2 = dtype2c( t3 ); + + // Resolve the 0D expression: + if ( /[cz]/.test( signature ) ) { + if ( ch1 === ch2 ) { // e.g., z_z, c_c + tmp = 'v'; + } else if ( ch2 === 'z' ) { // e.g., c_z, d_z, u_z + tmp = format( 'stdlib_complex128_from_%s( v )', char2dtype( ch1 ) );// e.g., stdlib_complex128_from_float64( v ) + } else if ( ch2 === 'c' ) { + if ( ch1 === 'z' ) { // e.g., z_c + tmp = 'stdlib_complex128_to_complex64( v )'; + } else { // e.g., f_c + tmp = format( 'stdlib_complex64_from_%s( v )', char2dtype( ch1 ) ); + } + } else { // e.g., z_d, c_f + // Based on type promotion rules and conventions, we shouldn't reach here. + } + } else if ( ch1 === ch2 ) { // e.g., d_d, f_f, b_b + tmp = 'v'; + } else { // e.g., b_d, f_d + tmp = format( '(%s)v', ct2 ); // e.g., (double)v + } + file = replace( file, '{{EXPRESSION_0D}}', tmp ); + + // Resolve the loop macro: + if ( /[cz]/.test( signature ) ) { + // E.g., z_z, c_c, c_z, f_c, d_z, u_z, #_(c|z), etc. + if ( ch1 === ch2 ) { // e.g., z_z, c_c + macro = MACROS.nocast; + args = [ ct1, ct2 ]; + } else if ( ch2 === 'z' ) { // e.g., c_z, d_z, u_z + macro = MACROS.fcast; + args = [ ct1, ct2, 'stdlib_complex128_from_'+char2dtype( ch1 ) ]; + } else if ( ch2 === 'c' ) { + macro = MACROS.fcast; + args = [ ct1, ct2 ]; + if ( ch1 === 'z' ) { // e.g., z_c + args.push( 'stdlib_complex128_to_complex64' ); + } else { // e.g., f_c + args.push( 'stdlib_complex64_from_'+char2dtype( ch1 ) ); + } + } else { // e.g., z_d + throw new Error( 'unexpected error. Should not reach this branch according to type promotion rules.' ); + } + } else { + macro = MACROS.cast; + args = [ ct1, ct2 ]; + } + file = replace( file, '{{LOOP_MACRO}}', macro ); + file = replace( file, '{{LOOP_MACRO_ARGUMENTS}}', args.join( ', ' ) ); + + // Create the source file: + fpath = path.join( SRC_DIR, signature+'.c' ); + debug( 'Creating source file: %s', fpath ); + err = writeFile( fpath, file, FOPTS ); + if ( err ) { + throw err; + } +} + +/** +* Creates source files for a list of loop signatures. +* +* @private +* @param {StringArray} signatures - list of loop signatures +*/ +function createSourceFiles( signatures ) { + var i; + for ( i = 0; i < signatures.length; i++ ) { + createSourceFile( signatures[ i ] ); + } +} + +/** +* Generates README documentation for a loop interface. +* +* @private +* @param {string} signature - loop signature +* @returns {string} documentation +*/ +function createDoc( signature ) { + var match; + var doc; + var ch1; + var ch2; + var nb1; + var nb2; + var nb3; + var t1; + var t2; + var t3; + + doc = replace( TMPL_README, '{{SIGNATURE}}', signature ); + + // Ensure appropriate header files are included in documentation examples: + doc = replace( doc, '{{EXAMPLE_INCLUDES}}', '' ); + + // Resolve the array data types: + match = signature.match( RE_SIGNATURE ); + t2 = 'uint8'; + ch1 = match[ 1 ]; + t1 = char2dtype( ch1 ); + ch2 = match[ 2 ]; + t3 = char2dtype( ch2 ); + + // Define array data types: + doc = replace( doc, '{{INPUT_NDARRAY_1_DTYPE_UPPER}}', uppercase( t1 ) ); + doc = replace( doc, '{{OUTPUT_NDARRAY_DTYPE_UPPER}}', uppercase( t3 ) ); + + // Define the number of bytes per element for the respective arrays: + nb1 = bytesPerElement( t1 ); + doc = replace( doc, '{{INPUT_NDARRAY_1_BYTES_PER_ELEMENT}}', nb1.toString() ); + + nb2 = bytesPerElement( t2 ); + doc = replace( doc, '{{INPUT_NDARRAY_2_BYTES_PER_ELEMENT}}', nb2.toString() ); + + nb3 = bytesPerElement( t3 ); + doc = replace( doc, '{{OUTPUT_NDARRAY_BYTES_PER_ELEMENT}}', nb3.toString() ); + + // Define the array INPUT_SHAPES: + doc = defineShapes( doc ); + + // Define underlying byte arrays: + doc = defineByteArrays( doc, nb1, nb2, nb3 ); + + // Define array strides: + doc = defineStrides( doc, nb1, nb2, nb3 ); + + return doc; +} + +/** +* Returns a character code list item. +* +* @private +* @param {string} dtype - data type +* @returns {string} list item +*/ +function charCodeListItem( dtype ) { + return [ + '- **', + dtypeChar( dtype ), + '**: `', + dtype, + '` (', + dtypeDesc( dtype ), + ').' + ].join( '' ); +} + +/** +* Returns a list of character code descriptions. +* +* @private +* @param {StringArray} dtypes - list of data types +* @returns {StringArray} list of character code descriptions +*/ +function charCodeList( dtypes ) { + var out; + var i; + + out = []; + for ( i = 0; i < dtypes.length; i++ ) { + out.push( charCodeListItem( dtypes[ i ] ) ); + } + return out; +} + +/** +* Update the package README. +* +* @private +* @param {StringArray} signatures - list of (sorted) loop signatures +* @throws {Error} unexpected error +*/ +function updateREADME( signatures ) { + var parts; + var file; + var docs; + var out; + var err; + var i; + + file = readFile( README, FOPTS ); + if ( file instanceof Error ) { + throw file; + } + docs = []; + for ( i = 0; i < signatures.length; i++ ) { + docs.push( createDoc( signatures[ i ] ) ); + } + out = []; + parts = file.split( '\n' ); + out.push( parts[ 0 ] ); + out.push( '' ); + out.push( '' ); + out.push( charCodeList( DTYPES ).join( '\n' ) ); + out.push( '' ); + + parts = parts[ 1 ].split( '\n' ); + out.push( '' ); + + parts = parts[ 1 ].split( '\n' ); + out.push( parts[ 0 ] ); + out.push( '' ); + out.push( '' ); + out.push( docs.join( '\n' ) ); + + parts = parts[ 1 ].split( '\n' ); + out.push( '' ); + out.push( parts[ 1 ] ); + + err = writeFile( README, out.join( '\n' ), FOPTS ); + if ( err ) { + throw err; + } +} + +/** +* Updates the main header file. +* +* @private +* @param {StringArray} signatures - list of (sorted) loop signatures +* @throws {Error} unexpected error +*/ +function updateMainHeader( signatures ) { + var file; + var list; + var err; + var sig; + var ch; + var i; + + file = readFile( INCLUDE_MAIN, FOPTS ); + if ( file instanceof Error ) { + throw file; + } + list = []; + ch = signatures[ 0 ].charAt( 0 ); + for ( i = 0; i < signatures.length; i++ ) { + sig = signatures[ i ]; + if ( sig.charAt( 0 ) !== ch ) { + ch = sig.charAt( 0 ); + list.push( '' ); + } + list.push( '#include "mskfilter/'+sig+'.h"' ); + } + file = [ + substringBefore( file, '\n// BEGIN LOOPS' ), + '// BEGIN LOOPS', + list.join( '\n' ), + '// END LOOPS', + substringAfter( file, '// END LOOPS\n' ) + ].join( '\n' ); + + err = writeFile( INCLUDE_MAIN, file, FOPTS ); + if ( err ) { + throw err; + } +} + +/** +* Updates the package manifest. +* +* @private +* @param {StringArray} signatures - list of (sorted) loop signatures +* @throws {Error} unexpected error +*/ +function updateManifest( signatures ) { + var file; + var list; + var tmp; + var err; + var l; + var i; + var j; + + file = readJSON( MANIFEST, FOPTS ); + if ( file instanceof Error ) { + throw file; + } + list = []; + for ( i = 0; i < signatures.length; i++ ) { + list.push( './src/'+signatures[ i ]+'.c' ); + } + for ( j = 0; j < file.confs.length; j++ ) { + l = list.slice(); + + // Copy over non-signature source files... + tmp = file.confs[ j ].src; + for ( i = 0; i < tmp.length; i++ ) { + if ( RE_MANIFEST_LOOP_FILE.test( tmp[ i ] ) === false ) { + l.push( tmp[ i ] ); + } + } + // Replace the list of source files: + file.confs[ j ].src = l; + } + err = writeFile( MANIFEST, JSON.stringify( file, null, 2 )+'\n', FOPTS ); + if ( err ) { + throw err; + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var sigs; + + debug( 'Data types: %s', DTYPES.join( ', ' ) ); + + // Generate the list of loop signatures: + sigs = signatures( DTYPES ); + debug( 'Signatures: %s', '\n'+sigs.join( '\n' ) ); + + // Remove loop files from output directories: + debug( 'Clearing include directory: %s', INCLUDE_DIR ); + removeLoopFiles( INCLUDE_DIR ); + + debug( 'Clearing source directory: %s', SRC_DIR ); + removeLoopFiles( SRC_DIR ); + + // Create header files for the list of loop signatures: + debug( 'Creating header files...' ); + createHeaderFiles( sigs ); + + // Create source files for the list of loop signatures: + debug( 'Creating source files...' ); + createSourceFiles( sigs ); + + // Update the main header file to include the loop header files: + debug( 'Updating main header file: %s', INCLUDE_MAIN ); + updateMainHeader( sigs ); + + // Update the package manifest to include the loop source files: + debug( 'Updating manifest file: %s', MANIFEST ); + updateManifest( sigs ); + + // Update the package README to include the loop interfaces: + debug( 'Updating README file: %s', README ); + updateREADME( sigs ); + + debug( 'Finished.' ); +} + +main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/docs.txt b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/docs.txt new file mode 100644 index 000000000000..78b95cd2656d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/docs.txt @@ -0,0 +1,96 @@ +#### stdlib_ndarray_mskfilter_{{SIGNATURE}}( \*arrays\[] ) + +Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. + +```c +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +#include +#include +#include + +// Define the ndarray data types: +enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; + +// Create underlying byte arrays: +uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; +uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_2D}} }; +uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; + +// Define the number of dimensions: +int64_t ndims = 2; + +// Define the array shapes: +int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +int64_t shy[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +int64_t shm[] = { {{OUTPUT_NDARRAY_SHAPE_2D}} }; + +// Define the strides: +int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; +int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_2D}} }; +int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; + +// Define the offsets: +int64_t ox = 0; +int64_t om = 0; +int64_t oy = 0; + +// Define the array order: +enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + +// Specify the index mode: +enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + +// Specify the subscript index modes: +int8_t submodes[] = { imode }; +int64_t nsubmodes = 1; + +// Create an input ndarray: +struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +if ( x == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create a mask ndarray: +struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +if ( mask == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an output ndarray: +struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +if ( y == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( EXIT_FAILURE ); +} + +// Create an array containing the ndarrays: +struct ndarray *arrays[] = { x, mask, y }; + +int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}( arrays ); +if ( status != 0 ) { + fprintf( stderr, "Error during computation.\n" ); + exit( EXIT_FAILURE ); +} + +// ... + +// Free allocated memory: +stdlib_ndarray_free( x ); +stdlib_ndarray_free( mask ); +stdlib_ndarray_free( y ); +``` + +The function accepts the following arguments: + +- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray. + +```c +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}( struct ndarray *arrays[] ); +``` diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/header.txt b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/header.txt new file mode 100644 index 000000000000..bf8de1199688 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/header.txt @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) {{YEAR}} {{COPYRIGHT}}. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#ifndef STDLIB_NDARRAY_BASE_MSKFILTER_{{INCLUDE_GUARD}}_H +#define STDLIB_NDARRAY_BASE_MSKFILTER_{{INCLUDE_GUARD}}_H + +#include "stdlib/ndarray/ctor.h" +#include + +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_0d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_1d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_2d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_2d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_3d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_3d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_4d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_4d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_5d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_5d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_6d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_6d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_7d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_7d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_8d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_8d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_9d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_9d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_10d( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_10d_blocked( struct ndarray *arrays[] ); + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +*/ +int8_t stdlib_ndarray_{{SIGNATURE}}_nd( struct ndarray *arrays[] ); + +#ifdef __cplusplus +} +#endif + +#endif // !STDLIB_NDARRAY_BASE_MSKFILTER_{{INCLUDE_GUARD}}_H diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/source.txt b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/source.txt new file mode 100644 index 000000000000..6d97e1c391ff --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/scripts/templates/source.txt @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) {{YEAR}} {{COPYRIGHT}}. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h"{{INCLUDES}} +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_0D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_0D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_0D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_1D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_1D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_1D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_1D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_1D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_1D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_BYTES_PER_ELEMENT}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_BYTES_PER_ELEMENT}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_BYTES_PER_ELEMENT}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_2D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_2D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_2D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_2D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_2D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_2D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_3D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_3D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_3D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_3D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_3D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_3D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_3D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_3D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_3D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_3D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_3D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_3D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_3D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_3D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_3D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_3D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_3D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_3D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_4D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_4D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_4D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_4D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_4D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_4D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_4D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_4D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_4D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_4D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_4D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_4D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_4D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_4D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_4D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_4D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_4D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_4D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_5D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_5D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_5D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_5D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_5D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_5D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_5D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_5D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_5D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_5D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_5D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_5D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_5D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_5D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_5D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_5D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_5D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_5D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_6D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_6D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_6D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_6D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_6D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_6D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_6D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_6D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_6D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_6D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_6D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_6D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_6D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_6D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_6D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_6D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_6D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_6D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_7D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_7D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_7D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_7D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_7D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_7D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_7D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_7D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_7D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_7D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_7D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_7D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_7D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_7D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_7D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_7D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_7D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_7D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_8D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_8D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_8D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_8D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_8D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_8D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_8D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_8D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_8D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_8D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_8D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_8D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_8D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_8D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_8D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_8D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_8D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_8D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_9D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_9D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_9D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_9D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_9D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_9D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_9D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_9D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_9D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_9D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_9D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_9D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_9D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_9D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_9D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_9D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_9D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_9D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_10D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_10D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_10D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_10D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_10D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_10D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_10D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_10D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_10D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_10D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_10D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_10D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_10D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_10D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_10D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_10D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_10D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_10D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_3D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_3D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_3D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_3D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_3D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_3D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_3D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_3D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_3D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_{{SIGNATURE}}_0d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_1d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_2d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_3d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_4d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_5d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_6d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_7d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_8d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_9d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_10d, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_{{SIGNATURE}}_2d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_3d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_4d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_5d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_6d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_7d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_8d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_9d_blocked, + stdlib_ndarray_mskfilter_{{SIGNATURE}}_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/{{SIGNATURE}}.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; +* uint8_t mbuf[] = { {{INPUT_NDARRAY_2_BYTES_2D}} }; +* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +* int64_t shm[] = { {{INPUT_NDARRAY_SHAPE_2D}} }; +* int64_t shy[] = { {{OUTPUT_NDARRAY_SHAPE_2D}} }; +* +* // Define the strides: +* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; +* int64_t sm[] = { {{INPUT_NDARRAY_2_STRIDES_2D}} }; +* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_{{SIGNATURE}}( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_{{SIGNATURE}}( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_b.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_b.c new file mode 100644 index 000000000000..e724cf5705d7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_b.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_b.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_b_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, uint8_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_b_0d, + stdlib_ndarray_mskfilter_b_b_1d, + stdlib_ndarray_mskfilter_b_b_2d, + stdlib_ndarray_mskfilter_b_b_3d, + stdlib_ndarray_mskfilter_b_b_4d, + stdlib_ndarray_mskfilter_b_b_5d, + stdlib_ndarray_mskfilter_b_b_6d, + stdlib_ndarray_mskfilter_b_b_7d, + stdlib_ndarray_mskfilter_b_b_8d, + stdlib_ndarray_mskfilter_b_b_9d, + stdlib_ndarray_mskfilter_b_b_10d, + stdlib_ndarray_mskfilter_b_b_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_b_2d_blocked, + stdlib_ndarray_mskfilter_b_b_3d_blocked, + stdlib_ndarray_mskfilter_b_b_4d_blocked, + stdlib_ndarray_mskfilter_b_b_5d_blocked, + stdlib_ndarray_mskfilter_b_b_6d_blocked, + stdlib_ndarray_mskfilter_b_b_7d_blocked, + stdlib_ndarray_mskfilter_b_b_8d_blocked, + stdlib_ndarray_mskfilter_b_b_9d_blocked, + stdlib_ndarray_mskfilter_b_b_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_b( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_b( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_c.c new file mode 100644 index 000000000000..65a25e984138 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_c_0d, + stdlib_ndarray_mskfilter_b_c_1d, + stdlib_ndarray_mskfilter_b_c_2d, + stdlib_ndarray_mskfilter_b_c_3d, + stdlib_ndarray_mskfilter_b_c_4d, + stdlib_ndarray_mskfilter_b_c_5d, + stdlib_ndarray_mskfilter_b_c_6d, + stdlib_ndarray_mskfilter_b_c_7d, + stdlib_ndarray_mskfilter_b_c_8d, + stdlib_ndarray_mskfilter_b_c_9d, + stdlib_ndarray_mskfilter_b_c_10d, + stdlib_ndarray_mskfilter_b_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_c_2d_blocked, + stdlib_ndarray_mskfilter_b_c_3d_blocked, + stdlib_ndarray_mskfilter_b_c_4d_blocked, + stdlib_ndarray_mskfilter_b_c_5d_blocked, + stdlib_ndarray_mskfilter_b_c_6d_blocked, + stdlib_ndarray_mskfilter_b_c_7d_blocked, + stdlib_ndarray_mskfilter_b_c_8d_blocked, + stdlib_ndarray_mskfilter_b_c_9d_blocked, + stdlib_ndarray_mskfilter_b_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_d.c new file mode 100644 index 000000000000..9e7794fe85d1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_d_0d, + stdlib_ndarray_mskfilter_b_d_1d, + stdlib_ndarray_mskfilter_b_d_2d, + stdlib_ndarray_mskfilter_b_d_3d, + stdlib_ndarray_mskfilter_b_d_4d, + stdlib_ndarray_mskfilter_b_d_5d, + stdlib_ndarray_mskfilter_b_d_6d, + stdlib_ndarray_mskfilter_b_d_7d, + stdlib_ndarray_mskfilter_b_d_8d, + stdlib_ndarray_mskfilter_b_d_9d, + stdlib_ndarray_mskfilter_b_d_10d, + stdlib_ndarray_mskfilter_b_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_d_2d_blocked, + stdlib_ndarray_mskfilter_b_d_3d_blocked, + stdlib_ndarray_mskfilter_b_d_4d_blocked, + stdlib_ndarray_mskfilter_b_d_5d_blocked, + stdlib_ndarray_mskfilter_b_d_6d_blocked, + stdlib_ndarray_mskfilter_b_d_7d_blocked, + stdlib_ndarray_mskfilter_b_d_8d_blocked, + stdlib_ndarray_mskfilter_b_d_9d_blocked, + stdlib_ndarray_mskfilter_b_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_f.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_f.c new file mode 100644 index 000000000000..69f7d933d5a2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_f.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_f.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_f_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, float ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_f_0d, + stdlib_ndarray_mskfilter_b_f_1d, + stdlib_ndarray_mskfilter_b_f_2d, + stdlib_ndarray_mskfilter_b_f_3d, + stdlib_ndarray_mskfilter_b_f_4d, + stdlib_ndarray_mskfilter_b_f_5d, + stdlib_ndarray_mskfilter_b_f_6d, + stdlib_ndarray_mskfilter_b_f_7d, + stdlib_ndarray_mskfilter_b_f_8d, + stdlib_ndarray_mskfilter_b_f_9d, + stdlib_ndarray_mskfilter_b_f_10d, + stdlib_ndarray_mskfilter_b_f_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_f_2d_blocked, + stdlib_ndarray_mskfilter_b_f_3d_blocked, + stdlib_ndarray_mskfilter_b_f_4d_blocked, + stdlib_ndarray_mskfilter_b_f_5d_blocked, + stdlib_ndarray_mskfilter_b_f_6d_blocked, + stdlib_ndarray_mskfilter_b_f_7d_blocked, + stdlib_ndarray_mskfilter_b_f_8d_blocked, + stdlib_ndarray_mskfilter_b_f_9d_blocked, + stdlib_ndarray_mskfilter_b_f_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_f( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_f( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_i.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_i.c new file mode 100644 index 000000000000..1ac6a9bd9c46 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_i.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_i.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_i_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, int32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_i_0d, + stdlib_ndarray_mskfilter_b_i_1d, + stdlib_ndarray_mskfilter_b_i_2d, + stdlib_ndarray_mskfilter_b_i_3d, + stdlib_ndarray_mskfilter_b_i_4d, + stdlib_ndarray_mskfilter_b_i_5d, + stdlib_ndarray_mskfilter_b_i_6d, + stdlib_ndarray_mskfilter_b_i_7d, + stdlib_ndarray_mskfilter_b_i_8d, + stdlib_ndarray_mskfilter_b_i_9d, + stdlib_ndarray_mskfilter_b_i_10d, + stdlib_ndarray_mskfilter_b_i_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_i_2d_blocked, + stdlib_ndarray_mskfilter_b_i_3d_blocked, + stdlib_ndarray_mskfilter_b_i_4d_blocked, + stdlib_ndarray_mskfilter_b_i_5d_blocked, + stdlib_ndarray_mskfilter_b_i_6d_blocked, + stdlib_ndarray_mskfilter_b_i_7d_blocked, + stdlib_ndarray_mskfilter_b_i_8d_blocked, + stdlib_ndarray_mskfilter_b_i_9d_blocked, + stdlib_ndarray_mskfilter_b_i_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_i( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_i( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_k.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_k.c new file mode 100644 index 000000000000..718920ded957 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_k.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_k.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_k_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, int16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_k_0d, + stdlib_ndarray_mskfilter_b_k_1d, + stdlib_ndarray_mskfilter_b_k_2d, + stdlib_ndarray_mskfilter_b_k_3d, + stdlib_ndarray_mskfilter_b_k_4d, + stdlib_ndarray_mskfilter_b_k_5d, + stdlib_ndarray_mskfilter_b_k_6d, + stdlib_ndarray_mskfilter_b_k_7d, + stdlib_ndarray_mskfilter_b_k_8d, + stdlib_ndarray_mskfilter_b_k_9d, + stdlib_ndarray_mskfilter_b_k_10d, + stdlib_ndarray_mskfilter_b_k_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_k_2d_blocked, + stdlib_ndarray_mskfilter_b_k_3d_blocked, + stdlib_ndarray_mskfilter_b_k_4d_blocked, + stdlib_ndarray_mskfilter_b_k_5d_blocked, + stdlib_ndarray_mskfilter_b_k_6d_blocked, + stdlib_ndarray_mskfilter_b_k_7d_blocked, + stdlib_ndarray_mskfilter_b_k_8d_blocked, + stdlib_ndarray_mskfilter_b_k_9d_blocked, + stdlib_ndarray_mskfilter_b_k_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_k( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_k( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_t.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_t.c new file mode 100644 index 000000000000..91f8319e403b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_t.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_t.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_t_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, uint16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_t_0d, + stdlib_ndarray_mskfilter_b_t_1d, + stdlib_ndarray_mskfilter_b_t_2d, + stdlib_ndarray_mskfilter_b_t_3d, + stdlib_ndarray_mskfilter_b_t_4d, + stdlib_ndarray_mskfilter_b_t_5d, + stdlib_ndarray_mskfilter_b_t_6d, + stdlib_ndarray_mskfilter_b_t_7d, + stdlib_ndarray_mskfilter_b_t_8d, + stdlib_ndarray_mskfilter_b_t_9d, + stdlib_ndarray_mskfilter_b_t_10d, + stdlib_ndarray_mskfilter_b_t_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_t_2d_blocked, + stdlib_ndarray_mskfilter_b_t_3d_blocked, + stdlib_ndarray_mskfilter_b_t_4d_blocked, + stdlib_ndarray_mskfilter_b_t_5d_blocked, + stdlib_ndarray_mskfilter_b_t_6d_blocked, + stdlib_ndarray_mskfilter_b_t_7d_blocked, + stdlib_ndarray_mskfilter_b_t_8d_blocked, + stdlib_ndarray_mskfilter_b_t_9d_blocked, + stdlib_ndarray_mskfilter_b_t_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_t( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_t( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_u.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_u.c new file mode 100644 index 000000000000..dd871057a9cb --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_u.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_u.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_u_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint8_t, uint32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_u_0d, + stdlib_ndarray_mskfilter_b_u_1d, + stdlib_ndarray_mskfilter_b_u_2d, + stdlib_ndarray_mskfilter_b_u_3d, + stdlib_ndarray_mskfilter_b_u_4d, + stdlib_ndarray_mskfilter_b_u_5d, + stdlib_ndarray_mskfilter_b_u_6d, + stdlib_ndarray_mskfilter_b_u_7d, + stdlib_ndarray_mskfilter_b_u_8d, + stdlib_ndarray_mskfilter_b_u_9d, + stdlib_ndarray_mskfilter_b_u_10d, + stdlib_ndarray_mskfilter_b_u_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_u_2d_blocked, + stdlib_ndarray_mskfilter_b_u_3d_blocked, + stdlib_ndarray_mskfilter_b_u_4d_blocked, + stdlib_ndarray_mskfilter_b_u_5d_blocked, + stdlib_ndarray_mskfilter_b_u_6d_blocked, + stdlib_ndarray_mskfilter_b_u_7d_blocked, + stdlib_ndarray_mskfilter_b_u_8d_blocked, + stdlib_ndarray_mskfilter_b_u_9d_blocked, + stdlib_ndarray_mskfilter_b_u_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_u( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_u( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_z.c new file mode 100644 index 000000000000..72fa53a742a0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/b_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/b_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_b_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_b_z_0d, + stdlib_ndarray_mskfilter_b_z_1d, + stdlib_ndarray_mskfilter_b_z_2d, + stdlib_ndarray_mskfilter_b_z_3d, + stdlib_ndarray_mskfilter_b_z_4d, + stdlib_ndarray_mskfilter_b_z_5d, + stdlib_ndarray_mskfilter_b_z_6d, + stdlib_ndarray_mskfilter_b_z_7d, + stdlib_ndarray_mskfilter_b_z_8d, + stdlib_ndarray_mskfilter_b_z_9d, + stdlib_ndarray_mskfilter_b_z_10d, + stdlib_ndarray_mskfilter_b_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_b_z_2d_blocked, + stdlib_ndarray_mskfilter_b_z_3d_blocked, + stdlib_ndarray_mskfilter_b_z_4d_blocked, + stdlib_ndarray_mskfilter_b_z_5d_blocked, + stdlib_ndarray_mskfilter_b_z_6d_blocked, + stdlib_ndarray_mskfilter_b_z_7d_blocked, + stdlib_ndarray_mskfilter_b_z_8d_blocked, + stdlib_ndarray_mskfilter_b_z_9d_blocked, + stdlib_ndarray_mskfilter_b_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/b_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_b_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_b_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/c_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/c_c.c new file mode 100644 index 000000000000..801feaea90f7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/c_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/c_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_c_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 8 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_c_c_0d, + stdlib_ndarray_mskfilter_c_c_1d, + stdlib_ndarray_mskfilter_c_c_2d, + stdlib_ndarray_mskfilter_c_c_3d, + stdlib_ndarray_mskfilter_c_c_4d, + stdlib_ndarray_mskfilter_c_c_5d, + stdlib_ndarray_mskfilter_c_c_6d, + stdlib_ndarray_mskfilter_c_c_7d, + stdlib_ndarray_mskfilter_c_c_8d, + stdlib_ndarray_mskfilter_c_c_9d, + stdlib_ndarray_mskfilter_c_c_10d, + stdlib_ndarray_mskfilter_c_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_c_c_2d_blocked, + stdlib_ndarray_mskfilter_c_c_3d_blocked, + stdlib_ndarray_mskfilter_c_c_4d_blocked, + stdlib_ndarray_mskfilter_c_c_5d_blocked, + stdlib_ndarray_mskfilter_c_c_6d_blocked, + stdlib_ndarray_mskfilter_c_c_7d_blocked, + stdlib_ndarray_mskfilter_c_c_8d_blocked, + stdlib_ndarray_mskfilter_c_c_9d_blocked, + stdlib_ndarray_mskfilter_c_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/c_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/c_z.c new file mode 100644 index 000000000000..f42f42596f8c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/c_z.c @@ -0,0 +1,2300 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/c_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_c_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 8 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_c_z_0d, + stdlib_ndarray_mskfilter_c_z_1d, + stdlib_ndarray_mskfilter_c_z_2d, + stdlib_ndarray_mskfilter_c_z_3d, + stdlib_ndarray_mskfilter_c_z_4d, + stdlib_ndarray_mskfilter_c_z_5d, + stdlib_ndarray_mskfilter_c_z_6d, + stdlib_ndarray_mskfilter_c_z_7d, + stdlib_ndarray_mskfilter_c_z_8d, + stdlib_ndarray_mskfilter_c_z_9d, + stdlib_ndarray_mskfilter_c_z_10d, + stdlib_ndarray_mskfilter_c_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_c_z_2d_blocked, + stdlib_ndarray_mskfilter_c_z_3d_blocked, + stdlib_ndarray_mskfilter_c_z_4d_blocked, + stdlib_ndarray_mskfilter_c_z_5d_blocked, + stdlib_ndarray_mskfilter_c_z_6d_blocked, + stdlib_ndarray_mskfilter_c_z_7d_blocked, + stdlib_ndarray_mskfilter_c_z_8d_blocked, + stdlib_ndarray_mskfilter_c_z_9d_blocked, + stdlib_ndarray_mskfilter_c_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/c_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_c_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_c_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_c.c new file mode 100644 index 000000000000..a395ff5f950b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/d_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_d_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 8 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( double, stdlib_complex64_t, stdlib_complex64_from_float64 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_d_c_0d, + stdlib_ndarray_mskfilter_d_c_1d, + stdlib_ndarray_mskfilter_d_c_2d, + stdlib_ndarray_mskfilter_d_c_3d, + stdlib_ndarray_mskfilter_d_c_4d, + stdlib_ndarray_mskfilter_d_c_5d, + stdlib_ndarray_mskfilter_d_c_6d, + stdlib_ndarray_mskfilter_d_c_7d, + stdlib_ndarray_mskfilter_d_c_8d, + stdlib_ndarray_mskfilter_d_c_9d, + stdlib_ndarray_mskfilter_d_c_10d, + stdlib_ndarray_mskfilter_d_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_d_c_2d_blocked, + stdlib_ndarray_mskfilter_d_c_3d_blocked, + stdlib_ndarray_mskfilter_d_c_4d_blocked, + stdlib_ndarray_mskfilter_d_c_5d_blocked, + stdlib_ndarray_mskfilter_d_c_6d_blocked, + stdlib_ndarray_mskfilter_d_c_7d_blocked, + stdlib_ndarray_mskfilter_d_c_8d_blocked, + stdlib_ndarray_mskfilter_d_c_9d_blocked, + stdlib_ndarray_mskfilter_d_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_d.c new file mode 100644 index 000000000000..a0d81fcb429a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/d_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_d_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 8 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( double, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( double, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_d_d_0d, + stdlib_ndarray_mskfilter_d_d_1d, + stdlib_ndarray_mskfilter_d_d_2d, + stdlib_ndarray_mskfilter_d_d_3d, + stdlib_ndarray_mskfilter_d_d_4d, + stdlib_ndarray_mskfilter_d_d_5d, + stdlib_ndarray_mskfilter_d_d_6d, + stdlib_ndarray_mskfilter_d_d_7d, + stdlib_ndarray_mskfilter_d_d_8d, + stdlib_ndarray_mskfilter_d_d_9d, + stdlib_ndarray_mskfilter_d_d_10d, + stdlib_ndarray_mskfilter_d_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_d_d_2d_blocked, + stdlib_ndarray_mskfilter_d_d_3d_blocked, + stdlib_ndarray_mskfilter_d_d_4d_blocked, + stdlib_ndarray_mskfilter_d_d_5d_blocked, + stdlib_ndarray_mskfilter_d_d_6d_blocked, + stdlib_ndarray_mskfilter_d_d_7d_blocked, + stdlib_ndarray_mskfilter_d_d_8d_blocked, + stdlib_ndarray_mskfilter_d_d_9d_blocked, + stdlib_ndarray_mskfilter_d_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_f.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_f.c new file mode 100644 index 000000000000..37a076c0ee9b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_f.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/d_f.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_d_f_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 8 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( double, float ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( double, float ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_d_f_0d, + stdlib_ndarray_mskfilter_d_f_1d, + stdlib_ndarray_mskfilter_d_f_2d, + stdlib_ndarray_mskfilter_d_f_3d, + stdlib_ndarray_mskfilter_d_f_4d, + stdlib_ndarray_mskfilter_d_f_5d, + stdlib_ndarray_mskfilter_d_f_6d, + stdlib_ndarray_mskfilter_d_f_7d, + stdlib_ndarray_mskfilter_d_f_8d, + stdlib_ndarray_mskfilter_d_f_9d, + stdlib_ndarray_mskfilter_d_f_10d, + stdlib_ndarray_mskfilter_d_f_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_d_f_2d_blocked, + stdlib_ndarray_mskfilter_d_f_3d_blocked, + stdlib_ndarray_mskfilter_d_f_4d_blocked, + stdlib_ndarray_mskfilter_d_f_5d_blocked, + stdlib_ndarray_mskfilter_d_f_6d_blocked, + stdlib_ndarray_mskfilter_d_f_7d_blocked, + stdlib_ndarray_mskfilter_d_f_8d_blocked, + stdlib_ndarray_mskfilter_d_f_9d_blocked, + stdlib_ndarray_mskfilter_d_f_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_f( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_f( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_z.c new file mode 100644 index 000000000000..1913644e3ddc --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/d_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/d_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_d_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 8 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_d_z_0d, + stdlib_ndarray_mskfilter_d_z_1d, + stdlib_ndarray_mskfilter_d_z_2d, + stdlib_ndarray_mskfilter_d_z_3d, + stdlib_ndarray_mskfilter_d_z_4d, + stdlib_ndarray_mskfilter_d_z_5d, + stdlib_ndarray_mskfilter_d_z_6d, + stdlib_ndarray_mskfilter_d_z_7d, + stdlib_ndarray_mskfilter_d_z_8d, + stdlib_ndarray_mskfilter_d_z_9d, + stdlib_ndarray_mskfilter_d_z_10d, + stdlib_ndarray_mskfilter_d_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_d_z_2d_blocked, + stdlib_ndarray_mskfilter_d_z_3d_blocked, + stdlib_ndarray_mskfilter_d_z_4d_blocked, + stdlib_ndarray_mskfilter_d_z_5d_blocked, + stdlib_ndarray_mskfilter_d_z_6d_blocked, + stdlib_ndarray_mskfilter_d_z_7d_blocked, + stdlib_ndarray_mskfilter_d_z_8d_blocked, + stdlib_ndarray_mskfilter_d_z_9d_blocked, + stdlib_ndarray_mskfilter_d_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/d_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_d_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_d_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_c.c new file mode 100644 index 000000000000..20e296c835c9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/f_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_f_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_f_c_0d, + stdlib_ndarray_mskfilter_f_c_1d, + stdlib_ndarray_mskfilter_f_c_2d, + stdlib_ndarray_mskfilter_f_c_3d, + stdlib_ndarray_mskfilter_f_c_4d, + stdlib_ndarray_mskfilter_f_c_5d, + stdlib_ndarray_mskfilter_f_c_6d, + stdlib_ndarray_mskfilter_f_c_7d, + stdlib_ndarray_mskfilter_f_c_8d, + stdlib_ndarray_mskfilter_f_c_9d, + stdlib_ndarray_mskfilter_f_c_10d, + stdlib_ndarray_mskfilter_f_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_f_c_2d_blocked, + stdlib_ndarray_mskfilter_f_c_3d_blocked, + stdlib_ndarray_mskfilter_f_c_4d_blocked, + stdlib_ndarray_mskfilter_f_c_5d_blocked, + stdlib_ndarray_mskfilter_f_c_6d_blocked, + stdlib_ndarray_mskfilter_f_c_7d_blocked, + stdlib_ndarray_mskfilter_f_c_8d_blocked, + stdlib_ndarray_mskfilter_f_c_9d_blocked, + stdlib_ndarray_mskfilter_f_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_d.c new file mode 100644 index 000000000000..f4f4c41611ad --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/f_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_f_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( float, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( float, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_f_d_0d, + stdlib_ndarray_mskfilter_f_d_1d, + stdlib_ndarray_mskfilter_f_d_2d, + stdlib_ndarray_mskfilter_f_d_3d, + stdlib_ndarray_mskfilter_f_d_4d, + stdlib_ndarray_mskfilter_f_d_5d, + stdlib_ndarray_mskfilter_f_d_6d, + stdlib_ndarray_mskfilter_f_d_7d, + stdlib_ndarray_mskfilter_f_d_8d, + stdlib_ndarray_mskfilter_f_d_9d, + stdlib_ndarray_mskfilter_f_d_10d, + stdlib_ndarray_mskfilter_f_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_f_d_2d_blocked, + stdlib_ndarray_mskfilter_f_d_3d_blocked, + stdlib_ndarray_mskfilter_f_d_4d_blocked, + stdlib_ndarray_mskfilter_f_d_5d_blocked, + stdlib_ndarray_mskfilter_f_d_6d_blocked, + stdlib_ndarray_mskfilter_f_d_7d_blocked, + stdlib_ndarray_mskfilter_f_d_8d_blocked, + stdlib_ndarray_mskfilter_f_d_9d_blocked, + stdlib_ndarray_mskfilter_f_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_f.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_f.c new file mode 100644 index 000000000000..6d58235f88c7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_f.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/f_f.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_f_f_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( float, float ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( float, float ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_f_f_0d, + stdlib_ndarray_mskfilter_f_f_1d, + stdlib_ndarray_mskfilter_f_f_2d, + stdlib_ndarray_mskfilter_f_f_3d, + stdlib_ndarray_mskfilter_f_f_4d, + stdlib_ndarray_mskfilter_f_f_5d, + stdlib_ndarray_mskfilter_f_f_6d, + stdlib_ndarray_mskfilter_f_f_7d, + stdlib_ndarray_mskfilter_f_f_8d, + stdlib_ndarray_mskfilter_f_f_9d, + stdlib_ndarray_mskfilter_f_f_10d, + stdlib_ndarray_mskfilter_f_f_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_f_f_2d_blocked, + stdlib_ndarray_mskfilter_f_f_3d_blocked, + stdlib_ndarray_mskfilter_f_f_4d_blocked, + stdlib_ndarray_mskfilter_f_f_5d_blocked, + stdlib_ndarray_mskfilter_f_f_6d_blocked, + stdlib_ndarray_mskfilter_f_f_7d_blocked, + stdlib_ndarray_mskfilter_f_f_8d_blocked, + stdlib_ndarray_mskfilter_f_f_9d_blocked, + stdlib_ndarray_mskfilter_f_f_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_f( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_f( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_z.c new file mode 100644 index 000000000000..2681a0908d7d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/f_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/f_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_f_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_f_z_0d, + stdlib_ndarray_mskfilter_f_z_1d, + stdlib_ndarray_mskfilter_f_z_2d, + stdlib_ndarray_mskfilter_f_z_3d, + stdlib_ndarray_mskfilter_f_z_4d, + stdlib_ndarray_mskfilter_f_z_5d, + stdlib_ndarray_mskfilter_f_z_6d, + stdlib_ndarray_mskfilter_f_z_7d, + stdlib_ndarray_mskfilter_f_z_8d, + stdlib_ndarray_mskfilter_f_z_9d, + stdlib_ndarray_mskfilter_f_z_10d, + stdlib_ndarray_mskfilter_f_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_f_z_2d_blocked, + stdlib_ndarray_mskfilter_f_z_3d_blocked, + stdlib_ndarray_mskfilter_f_z_4d_blocked, + stdlib_ndarray_mskfilter_f_z_5d_blocked, + stdlib_ndarray_mskfilter_f_z_6d_blocked, + stdlib_ndarray_mskfilter_f_z_7d_blocked, + stdlib_ndarray_mskfilter_f_z_8d_blocked, + stdlib_ndarray_mskfilter_f_z_9d_blocked, + stdlib_ndarray_mskfilter_f_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/f_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_f_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_f_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_d.c new file mode 100644 index 000000000000..ca5a66831928 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/i_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_i_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int32_t, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_i_d_0d, + stdlib_ndarray_mskfilter_i_d_1d, + stdlib_ndarray_mskfilter_i_d_2d, + stdlib_ndarray_mskfilter_i_d_3d, + stdlib_ndarray_mskfilter_i_d_4d, + stdlib_ndarray_mskfilter_i_d_5d, + stdlib_ndarray_mskfilter_i_d_6d, + stdlib_ndarray_mskfilter_i_d_7d, + stdlib_ndarray_mskfilter_i_d_8d, + stdlib_ndarray_mskfilter_i_d_9d, + stdlib_ndarray_mskfilter_i_d_10d, + stdlib_ndarray_mskfilter_i_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_i_d_2d_blocked, + stdlib_ndarray_mskfilter_i_d_3d_blocked, + stdlib_ndarray_mskfilter_i_d_4d_blocked, + stdlib_ndarray_mskfilter_i_d_5d_blocked, + stdlib_ndarray_mskfilter_i_d_6d_blocked, + stdlib_ndarray_mskfilter_i_d_7d_blocked, + stdlib_ndarray_mskfilter_i_d_8d_blocked, + stdlib_ndarray_mskfilter_i_d_9d_blocked, + stdlib_ndarray_mskfilter_i_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_i.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_i.c new file mode 100644 index 000000000000..a5c7537cf745 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_i.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/i_i.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_i_i_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int32_t, int32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_i_i_0d, + stdlib_ndarray_mskfilter_i_i_1d, + stdlib_ndarray_mskfilter_i_i_2d, + stdlib_ndarray_mskfilter_i_i_3d, + stdlib_ndarray_mskfilter_i_i_4d, + stdlib_ndarray_mskfilter_i_i_5d, + stdlib_ndarray_mskfilter_i_i_6d, + stdlib_ndarray_mskfilter_i_i_7d, + stdlib_ndarray_mskfilter_i_i_8d, + stdlib_ndarray_mskfilter_i_i_9d, + stdlib_ndarray_mskfilter_i_i_10d, + stdlib_ndarray_mskfilter_i_i_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_i_i_2d_blocked, + stdlib_ndarray_mskfilter_i_i_3d_blocked, + stdlib_ndarray_mskfilter_i_i_4d_blocked, + stdlib_ndarray_mskfilter_i_i_5d_blocked, + stdlib_ndarray_mskfilter_i_i_6d_blocked, + stdlib_ndarray_mskfilter_i_i_7d_blocked, + stdlib_ndarray_mskfilter_i_i_8d_blocked, + stdlib_ndarray_mskfilter_i_i_9d_blocked, + stdlib_ndarray_mskfilter_i_i_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_i( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_i( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_u.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_u.c new file mode 100644 index 000000000000..6f0333972e0c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_u.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/i_u.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_i_u_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int32_t, uint32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_i_u_0d, + stdlib_ndarray_mskfilter_i_u_1d, + stdlib_ndarray_mskfilter_i_u_2d, + stdlib_ndarray_mskfilter_i_u_3d, + stdlib_ndarray_mskfilter_i_u_4d, + stdlib_ndarray_mskfilter_i_u_5d, + stdlib_ndarray_mskfilter_i_u_6d, + stdlib_ndarray_mskfilter_i_u_7d, + stdlib_ndarray_mskfilter_i_u_8d, + stdlib_ndarray_mskfilter_i_u_9d, + stdlib_ndarray_mskfilter_i_u_10d, + stdlib_ndarray_mskfilter_i_u_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_i_u_2d_blocked, + stdlib_ndarray_mskfilter_i_u_3d_blocked, + stdlib_ndarray_mskfilter_i_u_4d_blocked, + stdlib_ndarray_mskfilter_i_u_5d_blocked, + stdlib_ndarray_mskfilter_i_u_6d_blocked, + stdlib_ndarray_mskfilter_i_u_7d_blocked, + stdlib_ndarray_mskfilter_i_u_8d_blocked, + stdlib_ndarray_mskfilter_i_u_9d_blocked, + stdlib_ndarray_mskfilter_i_u_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_u( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_u( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_z.c new file mode 100644 index 000000000000..e587ab69e69d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/i_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/i_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_i_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_i_z_0d, + stdlib_ndarray_mskfilter_i_z_1d, + stdlib_ndarray_mskfilter_i_z_2d, + stdlib_ndarray_mskfilter_i_z_3d, + stdlib_ndarray_mskfilter_i_z_4d, + stdlib_ndarray_mskfilter_i_z_5d, + stdlib_ndarray_mskfilter_i_z_6d, + stdlib_ndarray_mskfilter_i_z_7d, + stdlib_ndarray_mskfilter_i_z_8d, + stdlib_ndarray_mskfilter_i_z_9d, + stdlib_ndarray_mskfilter_i_z_10d, + stdlib_ndarray_mskfilter_i_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_i_z_2d_blocked, + stdlib_ndarray_mskfilter_i_z_3d_blocked, + stdlib_ndarray_mskfilter_i_z_4d_blocked, + stdlib_ndarray_mskfilter_i_z_5d_blocked, + stdlib_ndarray_mskfilter_i_z_6d_blocked, + stdlib_ndarray_mskfilter_i_z_7d_blocked, + stdlib_ndarray_mskfilter_i_z_8d_blocked, + stdlib_ndarray_mskfilter_i_z_9d_blocked, + stdlib_ndarray_mskfilter_i_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/i_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_i_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_i_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/permute.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/permute.c new file mode 100644 index 000000000000..e1a1d0b1d9bf --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/permute.c @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/ndarray/base/mskfilter/internal/permute.h" +#include + +/** +* Permutes an input array according to a provided index array. +* +* @param n number of elements to permute +* @param arr input array +* @param idx permutation indices +* @param out output array +*/ +void stdlib_ndarray_base_mskfilter_internal_permute( const int64_t n, const int64_t *arr, const int64_t *idx, int64_t *out ) { + int64_t i; + for ( i = 0; i < n; i++ ) { + out[ i ] = arr[ idx[i] ]; + } +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/range.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/range.c new file mode 100644 index 000000000000..fff48b8c64f2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/range.c @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/ndarray/base/mskfilter/internal/range.h" +#include + +/** +* Writes `n` evenly spaced values from `0` to `n-1` to an output array. +* +* @param n number of values to write +* @param out output array +*/ +void stdlib_ndarray_base_mskfilter_internal_range( const int64_t n, int64_t *out ) { + int64_t i; + for ( i = 0; i < n; i++ ) { + out[ i ] = i; + } +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/sort2ins.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/sort2ins.c new file mode 100644 index 000000000000..07409306b968 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/internal/sort2ins.c @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/ndarray/base/mskfilter/internal/sort2ins.h" +#include + +/** +* Simultaneously sorts two arrays based on the sort order of the first array using insertion sort. +* +* ## Notes +* +* - The first array is sorted in increasing order according to absolute value. +* - The algorithm has space complexity `O(1)` and worst case time complexity `O(N^2)`. +* - The algorithm is efficient for small arrays (typically `N <= 20``) and is particularly efficient for sorting arrays which are already substantially sorted. +* - The algorithm is **stable**, meaning that the algorithm does **not** change the order of array elements which are equal or equivalent. +* - The input arrays are sorted in-place (i.e., the input arrays are mutated). +* +* @param n number of elements +* @param x first array +* @param y second array +*/ +void stdlib_ndarray_base_mskfilter_internal_sort2ins( const int64_t n, int64_t *x, int64_t *y ) { + int64_t avx; + int64_t aux; + int64_t ix; + int64_t iy; + int64_t jx; + int64_t jy; + int64_t vx; + int64_t vy; + int64_t ux; + int64_t i; + + ix = 1; + iy = 1; + + // Sort in increasing order... + for ( i = 1; i < n; i++ ) { + vx = x[ ix ]; + avx = ( vx < 0 ) ? -vx : vx; + + vy = y[ iy ]; + + jx = ix - 1; + jy = iy - 1; + + // Shift all larger values to the left of the current element to the right... + while ( jx >= 0 ) { + ux = x[ jx ]; + aux = ( ux < 0 ) ? -ux : ux; + if ( aux <= avx ) { + break; + } + x[ jx+1 ] = ux; + y[ jy+1 ] = y[ jy ]; + jx -= 1; + jy -= 1; + } + x[ jx+1 ] = vx; + y[ jy+1 ] = vy; + ix += 1; + iy += 1; + } +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_c.c new file mode 100644 index 000000000000..3fdc4f9eb084 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_c_0d, + stdlib_ndarray_mskfilter_k_c_1d, + stdlib_ndarray_mskfilter_k_c_2d, + stdlib_ndarray_mskfilter_k_c_3d, + stdlib_ndarray_mskfilter_k_c_4d, + stdlib_ndarray_mskfilter_k_c_5d, + stdlib_ndarray_mskfilter_k_c_6d, + stdlib_ndarray_mskfilter_k_c_7d, + stdlib_ndarray_mskfilter_k_c_8d, + stdlib_ndarray_mskfilter_k_c_9d, + stdlib_ndarray_mskfilter_k_c_10d, + stdlib_ndarray_mskfilter_k_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_c_2d_blocked, + stdlib_ndarray_mskfilter_k_c_3d_blocked, + stdlib_ndarray_mskfilter_k_c_4d_blocked, + stdlib_ndarray_mskfilter_k_c_5d_blocked, + stdlib_ndarray_mskfilter_k_c_6d_blocked, + stdlib_ndarray_mskfilter_k_c_7d_blocked, + stdlib_ndarray_mskfilter_k_c_8d_blocked, + stdlib_ndarray_mskfilter_k_c_9d_blocked, + stdlib_ndarray_mskfilter_k_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_d.c new file mode 100644 index 000000000000..cfac929f1070 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int16_t, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_d_0d, + stdlib_ndarray_mskfilter_k_d_1d, + stdlib_ndarray_mskfilter_k_d_2d, + stdlib_ndarray_mskfilter_k_d_3d, + stdlib_ndarray_mskfilter_k_d_4d, + stdlib_ndarray_mskfilter_k_d_5d, + stdlib_ndarray_mskfilter_k_d_6d, + stdlib_ndarray_mskfilter_k_d_7d, + stdlib_ndarray_mskfilter_k_d_8d, + stdlib_ndarray_mskfilter_k_d_9d, + stdlib_ndarray_mskfilter_k_d_10d, + stdlib_ndarray_mskfilter_k_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_d_2d_blocked, + stdlib_ndarray_mskfilter_k_d_3d_blocked, + stdlib_ndarray_mskfilter_k_d_4d_blocked, + stdlib_ndarray_mskfilter_k_d_5d_blocked, + stdlib_ndarray_mskfilter_k_d_6d_blocked, + stdlib_ndarray_mskfilter_k_d_7d_blocked, + stdlib_ndarray_mskfilter_k_d_8d_blocked, + stdlib_ndarray_mskfilter_k_d_9d_blocked, + stdlib_ndarray_mskfilter_k_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_f.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_f.c new file mode 100644 index 000000000000..3fd266c97b4b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_f.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_f.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_f_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int16_t, float ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_f_0d, + stdlib_ndarray_mskfilter_k_f_1d, + stdlib_ndarray_mskfilter_k_f_2d, + stdlib_ndarray_mskfilter_k_f_3d, + stdlib_ndarray_mskfilter_k_f_4d, + stdlib_ndarray_mskfilter_k_f_5d, + stdlib_ndarray_mskfilter_k_f_6d, + stdlib_ndarray_mskfilter_k_f_7d, + stdlib_ndarray_mskfilter_k_f_8d, + stdlib_ndarray_mskfilter_k_f_9d, + stdlib_ndarray_mskfilter_k_f_10d, + stdlib_ndarray_mskfilter_k_f_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_f_2d_blocked, + stdlib_ndarray_mskfilter_k_f_3d_blocked, + stdlib_ndarray_mskfilter_k_f_4d_blocked, + stdlib_ndarray_mskfilter_k_f_5d_blocked, + stdlib_ndarray_mskfilter_k_f_6d_blocked, + stdlib_ndarray_mskfilter_k_f_7d_blocked, + stdlib_ndarray_mskfilter_k_f_8d_blocked, + stdlib_ndarray_mskfilter_k_f_9d_blocked, + stdlib_ndarray_mskfilter_k_f_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_f( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_f( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_i.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_i.c new file mode 100644 index 000000000000..6c5c4b41bb0a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_i.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_i.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_i_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int16_t, int32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_i_0d, + stdlib_ndarray_mskfilter_k_i_1d, + stdlib_ndarray_mskfilter_k_i_2d, + stdlib_ndarray_mskfilter_k_i_3d, + stdlib_ndarray_mskfilter_k_i_4d, + stdlib_ndarray_mskfilter_k_i_5d, + stdlib_ndarray_mskfilter_k_i_6d, + stdlib_ndarray_mskfilter_k_i_7d, + stdlib_ndarray_mskfilter_k_i_8d, + stdlib_ndarray_mskfilter_k_i_9d, + stdlib_ndarray_mskfilter_k_i_10d, + stdlib_ndarray_mskfilter_k_i_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_i_2d_blocked, + stdlib_ndarray_mskfilter_k_i_3d_blocked, + stdlib_ndarray_mskfilter_k_i_4d_blocked, + stdlib_ndarray_mskfilter_k_i_5d_blocked, + stdlib_ndarray_mskfilter_k_i_6d_blocked, + stdlib_ndarray_mskfilter_k_i_7d_blocked, + stdlib_ndarray_mskfilter_k_i_8d_blocked, + stdlib_ndarray_mskfilter_k_i_9d_blocked, + stdlib_ndarray_mskfilter_k_i_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_i( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_i( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_k.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_k.c new file mode 100644 index 000000000000..cdefdd528fd9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_k.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_k.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_k_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int16_t, int16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_k_0d, + stdlib_ndarray_mskfilter_k_k_1d, + stdlib_ndarray_mskfilter_k_k_2d, + stdlib_ndarray_mskfilter_k_k_3d, + stdlib_ndarray_mskfilter_k_k_4d, + stdlib_ndarray_mskfilter_k_k_5d, + stdlib_ndarray_mskfilter_k_k_6d, + stdlib_ndarray_mskfilter_k_k_7d, + stdlib_ndarray_mskfilter_k_k_8d, + stdlib_ndarray_mskfilter_k_k_9d, + stdlib_ndarray_mskfilter_k_k_10d, + stdlib_ndarray_mskfilter_k_k_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_k_2d_blocked, + stdlib_ndarray_mskfilter_k_k_3d_blocked, + stdlib_ndarray_mskfilter_k_k_4d_blocked, + stdlib_ndarray_mskfilter_k_k_5d_blocked, + stdlib_ndarray_mskfilter_k_k_6d_blocked, + stdlib_ndarray_mskfilter_k_k_7d_blocked, + stdlib_ndarray_mskfilter_k_k_8d_blocked, + stdlib_ndarray_mskfilter_k_k_9d_blocked, + stdlib_ndarray_mskfilter_k_k_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_k( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_k( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_t.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_t.c new file mode 100644 index 000000000000..024a4ab56fed --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_t.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_t.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_t_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int16_t, uint16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_t_0d, + stdlib_ndarray_mskfilter_k_t_1d, + stdlib_ndarray_mskfilter_k_t_2d, + stdlib_ndarray_mskfilter_k_t_3d, + stdlib_ndarray_mskfilter_k_t_4d, + stdlib_ndarray_mskfilter_k_t_5d, + stdlib_ndarray_mskfilter_k_t_6d, + stdlib_ndarray_mskfilter_k_t_7d, + stdlib_ndarray_mskfilter_k_t_8d, + stdlib_ndarray_mskfilter_k_t_9d, + stdlib_ndarray_mskfilter_k_t_10d, + stdlib_ndarray_mskfilter_k_t_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_t_2d_blocked, + stdlib_ndarray_mskfilter_k_t_3d_blocked, + stdlib_ndarray_mskfilter_k_t_4d_blocked, + stdlib_ndarray_mskfilter_k_t_5d_blocked, + stdlib_ndarray_mskfilter_k_t_6d_blocked, + stdlib_ndarray_mskfilter_k_t_7d_blocked, + stdlib_ndarray_mskfilter_k_t_8d_blocked, + stdlib_ndarray_mskfilter_k_t_9d_blocked, + stdlib_ndarray_mskfilter_k_t_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_t( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_t( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_u.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_u.c new file mode 100644 index 000000000000..8c940ebe780b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_u.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_u.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_u_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int16_t, uint32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_u_0d, + stdlib_ndarray_mskfilter_k_u_1d, + stdlib_ndarray_mskfilter_k_u_2d, + stdlib_ndarray_mskfilter_k_u_3d, + stdlib_ndarray_mskfilter_k_u_4d, + stdlib_ndarray_mskfilter_k_u_5d, + stdlib_ndarray_mskfilter_k_u_6d, + stdlib_ndarray_mskfilter_k_u_7d, + stdlib_ndarray_mskfilter_k_u_8d, + stdlib_ndarray_mskfilter_k_u_9d, + stdlib_ndarray_mskfilter_k_u_10d, + stdlib_ndarray_mskfilter_k_u_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_u_2d_blocked, + stdlib_ndarray_mskfilter_k_u_3d_blocked, + stdlib_ndarray_mskfilter_k_u_4d_blocked, + stdlib_ndarray_mskfilter_k_u_5d_blocked, + stdlib_ndarray_mskfilter_k_u_6d_blocked, + stdlib_ndarray_mskfilter_k_u_7d_blocked, + stdlib_ndarray_mskfilter_k_u_8d_blocked, + stdlib_ndarray_mskfilter_k_u_9d_blocked, + stdlib_ndarray_mskfilter_k_u_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_u( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_u( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_z.c new file mode 100644 index 000000000000..74b573d698ae --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/k_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/k_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_k_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_k_z_0d, + stdlib_ndarray_mskfilter_k_z_1d, + stdlib_ndarray_mskfilter_k_z_2d, + stdlib_ndarray_mskfilter_k_z_3d, + stdlib_ndarray_mskfilter_k_z_4d, + stdlib_ndarray_mskfilter_k_z_5d, + stdlib_ndarray_mskfilter_k_z_6d, + stdlib_ndarray_mskfilter_k_z_7d, + stdlib_ndarray_mskfilter_k_z_8d, + stdlib_ndarray_mskfilter_k_z_9d, + stdlib_ndarray_mskfilter_k_z_10d, + stdlib_ndarray_mskfilter_k_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_k_z_2d_blocked, + stdlib_ndarray_mskfilter_k_z_3d_blocked, + stdlib_ndarray_mskfilter_k_z_4d_blocked, + stdlib_ndarray_mskfilter_k_z_5d_blocked, + stdlib_ndarray_mskfilter_k_z_6d_blocked, + stdlib_ndarray_mskfilter_k_z_7d_blocked, + stdlib_ndarray_mskfilter_k_z_8d_blocked, + stdlib_ndarray_mskfilter_k_z_9d_blocked, + stdlib_ndarray_mskfilter_k_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/k_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_k_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_k_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_b.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_b.c new file mode 100644 index 000000000000..55614d3b35ec --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_b.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_b.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_b_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, uint8_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_b_0d, + stdlib_ndarray_mskfilter_s_b_1d, + stdlib_ndarray_mskfilter_s_b_2d, + stdlib_ndarray_mskfilter_s_b_3d, + stdlib_ndarray_mskfilter_s_b_4d, + stdlib_ndarray_mskfilter_s_b_5d, + stdlib_ndarray_mskfilter_s_b_6d, + stdlib_ndarray_mskfilter_s_b_7d, + stdlib_ndarray_mskfilter_s_b_8d, + stdlib_ndarray_mskfilter_s_b_9d, + stdlib_ndarray_mskfilter_s_b_10d, + stdlib_ndarray_mskfilter_s_b_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_b_2d_blocked, + stdlib_ndarray_mskfilter_s_b_3d_blocked, + stdlib_ndarray_mskfilter_s_b_4d_blocked, + stdlib_ndarray_mskfilter_s_b_5d_blocked, + stdlib_ndarray_mskfilter_s_b_6d_blocked, + stdlib_ndarray_mskfilter_s_b_7d_blocked, + stdlib_ndarray_mskfilter_s_b_8d_blocked, + stdlib_ndarray_mskfilter_s_b_9d_blocked, + stdlib_ndarray_mskfilter_s_b_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_b.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_b( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_b( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_c.c new file mode 100644 index 000000000000..c3c36a9abea2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_c_0d, + stdlib_ndarray_mskfilter_s_c_1d, + stdlib_ndarray_mskfilter_s_c_2d, + stdlib_ndarray_mskfilter_s_c_3d, + stdlib_ndarray_mskfilter_s_c_4d, + stdlib_ndarray_mskfilter_s_c_5d, + stdlib_ndarray_mskfilter_s_c_6d, + stdlib_ndarray_mskfilter_s_c_7d, + stdlib_ndarray_mskfilter_s_c_8d, + stdlib_ndarray_mskfilter_s_c_9d, + stdlib_ndarray_mskfilter_s_c_10d, + stdlib_ndarray_mskfilter_s_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_c_2d_blocked, + stdlib_ndarray_mskfilter_s_c_3d_blocked, + stdlib_ndarray_mskfilter_s_c_4d_blocked, + stdlib_ndarray_mskfilter_s_c_5d_blocked, + stdlib_ndarray_mskfilter_s_c_6d_blocked, + stdlib_ndarray_mskfilter_s_c_7d_blocked, + stdlib_ndarray_mskfilter_s_c_8d_blocked, + stdlib_ndarray_mskfilter_s_c_9d_blocked, + stdlib_ndarray_mskfilter_s_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_d.c new file mode 100644 index 000000000000..491f71ff5991 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_d_0d, + stdlib_ndarray_mskfilter_s_d_1d, + stdlib_ndarray_mskfilter_s_d_2d, + stdlib_ndarray_mskfilter_s_d_3d, + stdlib_ndarray_mskfilter_s_d_4d, + stdlib_ndarray_mskfilter_s_d_5d, + stdlib_ndarray_mskfilter_s_d_6d, + stdlib_ndarray_mskfilter_s_d_7d, + stdlib_ndarray_mskfilter_s_d_8d, + stdlib_ndarray_mskfilter_s_d_9d, + stdlib_ndarray_mskfilter_s_d_10d, + stdlib_ndarray_mskfilter_s_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_d_2d_blocked, + stdlib_ndarray_mskfilter_s_d_3d_blocked, + stdlib_ndarray_mskfilter_s_d_4d_blocked, + stdlib_ndarray_mskfilter_s_d_5d_blocked, + stdlib_ndarray_mskfilter_s_d_6d_blocked, + stdlib_ndarray_mskfilter_s_d_7d_blocked, + stdlib_ndarray_mskfilter_s_d_8d_blocked, + stdlib_ndarray_mskfilter_s_d_9d_blocked, + stdlib_ndarray_mskfilter_s_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_f.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_f.c new file mode 100644 index 000000000000..1623e1970e93 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_f.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_f.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_f_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, float ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, float ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_f_0d, + stdlib_ndarray_mskfilter_s_f_1d, + stdlib_ndarray_mskfilter_s_f_2d, + stdlib_ndarray_mskfilter_s_f_3d, + stdlib_ndarray_mskfilter_s_f_4d, + stdlib_ndarray_mskfilter_s_f_5d, + stdlib_ndarray_mskfilter_s_f_6d, + stdlib_ndarray_mskfilter_s_f_7d, + stdlib_ndarray_mskfilter_s_f_8d, + stdlib_ndarray_mskfilter_s_f_9d, + stdlib_ndarray_mskfilter_s_f_10d, + stdlib_ndarray_mskfilter_s_f_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_f_2d_blocked, + stdlib_ndarray_mskfilter_s_f_3d_blocked, + stdlib_ndarray_mskfilter_s_f_4d_blocked, + stdlib_ndarray_mskfilter_s_f_5d_blocked, + stdlib_ndarray_mskfilter_s_f_6d_blocked, + stdlib_ndarray_mskfilter_s_f_7d_blocked, + stdlib_ndarray_mskfilter_s_f_8d_blocked, + stdlib_ndarray_mskfilter_s_f_9d_blocked, + stdlib_ndarray_mskfilter_s_f_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_f( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_f( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_i.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_i.c new file mode 100644 index 000000000000..b5f8d19021d4 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_i.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_i.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_i_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, int32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_i_0d, + stdlib_ndarray_mskfilter_s_i_1d, + stdlib_ndarray_mskfilter_s_i_2d, + stdlib_ndarray_mskfilter_s_i_3d, + stdlib_ndarray_mskfilter_s_i_4d, + stdlib_ndarray_mskfilter_s_i_5d, + stdlib_ndarray_mskfilter_s_i_6d, + stdlib_ndarray_mskfilter_s_i_7d, + stdlib_ndarray_mskfilter_s_i_8d, + stdlib_ndarray_mskfilter_s_i_9d, + stdlib_ndarray_mskfilter_s_i_10d, + stdlib_ndarray_mskfilter_s_i_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_i_2d_blocked, + stdlib_ndarray_mskfilter_s_i_3d_blocked, + stdlib_ndarray_mskfilter_s_i_4d_blocked, + stdlib_ndarray_mskfilter_s_i_5d_blocked, + stdlib_ndarray_mskfilter_s_i_6d_blocked, + stdlib_ndarray_mskfilter_s_i_7d_blocked, + stdlib_ndarray_mskfilter_s_i_8d_blocked, + stdlib_ndarray_mskfilter_s_i_9d_blocked, + stdlib_ndarray_mskfilter_s_i_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_i( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_i( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_k.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_k.c new file mode 100644 index 000000000000..8a3c77341c4d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_k.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_k.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_k_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, int16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_k_0d, + stdlib_ndarray_mskfilter_s_k_1d, + stdlib_ndarray_mskfilter_s_k_2d, + stdlib_ndarray_mskfilter_s_k_3d, + stdlib_ndarray_mskfilter_s_k_4d, + stdlib_ndarray_mskfilter_s_k_5d, + stdlib_ndarray_mskfilter_s_k_6d, + stdlib_ndarray_mskfilter_s_k_7d, + stdlib_ndarray_mskfilter_s_k_8d, + stdlib_ndarray_mskfilter_s_k_9d, + stdlib_ndarray_mskfilter_s_k_10d, + stdlib_ndarray_mskfilter_s_k_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_k_2d_blocked, + stdlib_ndarray_mskfilter_s_k_3d_blocked, + stdlib_ndarray_mskfilter_s_k_4d_blocked, + stdlib_ndarray_mskfilter_s_k_5d_blocked, + stdlib_ndarray_mskfilter_s_k_6d_blocked, + stdlib_ndarray_mskfilter_s_k_7d_blocked, + stdlib_ndarray_mskfilter_s_k_8d_blocked, + stdlib_ndarray_mskfilter_s_k_9d_blocked, + stdlib_ndarray_mskfilter_s_k_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_k.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_k( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_k( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_s.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_s.c new file mode 100644 index 000000000000..ecc76a355378 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_s.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_s.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_s_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, int8_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_s_0d, + stdlib_ndarray_mskfilter_s_s_1d, + stdlib_ndarray_mskfilter_s_s_2d, + stdlib_ndarray_mskfilter_s_s_3d, + stdlib_ndarray_mskfilter_s_s_4d, + stdlib_ndarray_mskfilter_s_s_5d, + stdlib_ndarray_mskfilter_s_s_6d, + stdlib_ndarray_mskfilter_s_s_7d, + stdlib_ndarray_mskfilter_s_s_8d, + stdlib_ndarray_mskfilter_s_s_9d, + stdlib_ndarray_mskfilter_s_s_10d, + stdlib_ndarray_mskfilter_s_s_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_s_2d_blocked, + stdlib_ndarray_mskfilter_s_s_3d_blocked, + stdlib_ndarray_mskfilter_s_s_4d_blocked, + stdlib_ndarray_mskfilter_s_s_5d_blocked, + stdlib_ndarray_mskfilter_s_s_6d_blocked, + stdlib_ndarray_mskfilter_s_s_7d_blocked, + stdlib_ndarray_mskfilter_s_s_8d_blocked, + stdlib_ndarray_mskfilter_s_s_9d_blocked, + stdlib_ndarray_mskfilter_s_s_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_s.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_s( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_s( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_t.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_t.c new file mode 100644 index 000000000000..5c4e6e5e9bc1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_t.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_t.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_t_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, uint16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_t_0d, + stdlib_ndarray_mskfilter_s_t_1d, + stdlib_ndarray_mskfilter_s_t_2d, + stdlib_ndarray_mskfilter_s_t_3d, + stdlib_ndarray_mskfilter_s_t_4d, + stdlib_ndarray_mskfilter_s_t_5d, + stdlib_ndarray_mskfilter_s_t_6d, + stdlib_ndarray_mskfilter_s_t_7d, + stdlib_ndarray_mskfilter_s_t_8d, + stdlib_ndarray_mskfilter_s_t_9d, + stdlib_ndarray_mskfilter_s_t_10d, + stdlib_ndarray_mskfilter_s_t_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_t_2d_blocked, + stdlib_ndarray_mskfilter_s_t_3d_blocked, + stdlib_ndarray_mskfilter_s_t_4d_blocked, + stdlib_ndarray_mskfilter_s_t_5d_blocked, + stdlib_ndarray_mskfilter_s_t_6d_blocked, + stdlib_ndarray_mskfilter_s_t_7d_blocked, + stdlib_ndarray_mskfilter_s_t_8d_blocked, + stdlib_ndarray_mskfilter_s_t_9d_blocked, + stdlib_ndarray_mskfilter_s_t_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_t( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_t( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_u.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_u.c new file mode 100644 index 000000000000..a39035221459 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_u.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_u.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_u_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( int8_t, uint32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_u_0d, + stdlib_ndarray_mskfilter_s_u_1d, + stdlib_ndarray_mskfilter_s_u_2d, + stdlib_ndarray_mskfilter_s_u_3d, + stdlib_ndarray_mskfilter_s_u_4d, + stdlib_ndarray_mskfilter_s_u_5d, + stdlib_ndarray_mskfilter_s_u_6d, + stdlib_ndarray_mskfilter_s_u_7d, + stdlib_ndarray_mskfilter_s_u_8d, + stdlib_ndarray_mskfilter_s_u_9d, + stdlib_ndarray_mskfilter_s_u_10d, + stdlib_ndarray_mskfilter_s_u_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_u_2d_blocked, + stdlib_ndarray_mskfilter_s_u_3d_blocked, + stdlib_ndarray_mskfilter_s_u_4d_blocked, + stdlib_ndarray_mskfilter_s_u_5d_blocked, + stdlib_ndarray_mskfilter_s_u_6d_blocked, + stdlib_ndarray_mskfilter_s_u_7d_blocked, + stdlib_ndarray_mskfilter_s_u_8d_blocked, + stdlib_ndarray_mskfilter_s_u_9d_blocked, + stdlib_ndarray_mskfilter_s_u_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_u( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_u( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_z.c new file mode 100644 index 000000000000..204ed0547441 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/s_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/s_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_s_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_s_z_0d, + stdlib_ndarray_mskfilter_s_z_1d, + stdlib_ndarray_mskfilter_s_z_2d, + stdlib_ndarray_mskfilter_s_z_3d, + stdlib_ndarray_mskfilter_s_z_4d, + stdlib_ndarray_mskfilter_s_z_5d, + stdlib_ndarray_mskfilter_s_z_6d, + stdlib_ndarray_mskfilter_s_z_7d, + stdlib_ndarray_mskfilter_s_z_8d, + stdlib_ndarray_mskfilter_s_z_9d, + stdlib_ndarray_mskfilter_s_z_10d, + stdlib_ndarray_mskfilter_s_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_s_z_2d_blocked, + stdlib_ndarray_mskfilter_s_z_3d_blocked, + stdlib_ndarray_mskfilter_s_z_4d_blocked, + stdlib_ndarray_mskfilter_s_z_5d_blocked, + stdlib_ndarray_mskfilter_s_z_6d_blocked, + stdlib_ndarray_mskfilter_s_z_7d_blocked, + stdlib_ndarray_mskfilter_s_z_8d_blocked, + stdlib_ndarray_mskfilter_s_z_9d_blocked, + stdlib_ndarray_mskfilter_s_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/s_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_s_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_s_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_c.c new file mode 100644 index 000000000000..27a649c03b3f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_c.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_c_0d, + stdlib_ndarray_mskfilter_t_c_1d, + stdlib_ndarray_mskfilter_t_c_2d, + stdlib_ndarray_mskfilter_t_c_3d, + stdlib_ndarray_mskfilter_t_c_4d, + stdlib_ndarray_mskfilter_t_c_5d, + stdlib_ndarray_mskfilter_t_c_6d, + stdlib_ndarray_mskfilter_t_c_7d, + stdlib_ndarray_mskfilter_t_c_8d, + stdlib_ndarray_mskfilter_t_c_9d, + stdlib_ndarray_mskfilter_t_c_10d, + stdlib_ndarray_mskfilter_t_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_c_2d_blocked, + stdlib_ndarray_mskfilter_t_c_3d_blocked, + stdlib_ndarray_mskfilter_t_c_4d_blocked, + stdlib_ndarray_mskfilter_t_c_5d_blocked, + stdlib_ndarray_mskfilter_t_c_6d_blocked, + stdlib_ndarray_mskfilter_t_c_7d_blocked, + stdlib_ndarray_mskfilter_t_c_8d_blocked, + stdlib_ndarray_mskfilter_t_c_9d_blocked, + stdlib_ndarray_mskfilter_t_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_d.c new file mode 100644 index 000000000000..366e5e911415 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint16_t, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint16_t, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_d_0d, + stdlib_ndarray_mskfilter_t_d_1d, + stdlib_ndarray_mskfilter_t_d_2d, + stdlib_ndarray_mskfilter_t_d_3d, + stdlib_ndarray_mskfilter_t_d_4d, + stdlib_ndarray_mskfilter_t_d_5d, + stdlib_ndarray_mskfilter_t_d_6d, + stdlib_ndarray_mskfilter_t_d_7d, + stdlib_ndarray_mskfilter_t_d_8d, + stdlib_ndarray_mskfilter_t_d_9d, + stdlib_ndarray_mskfilter_t_d_10d, + stdlib_ndarray_mskfilter_t_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_d_2d_blocked, + stdlib_ndarray_mskfilter_t_d_3d_blocked, + stdlib_ndarray_mskfilter_t_d_4d_blocked, + stdlib_ndarray_mskfilter_t_d_5d_blocked, + stdlib_ndarray_mskfilter_t_d_6d_blocked, + stdlib_ndarray_mskfilter_t_d_7d_blocked, + stdlib_ndarray_mskfilter_t_d_8d_blocked, + stdlib_ndarray_mskfilter_t_d_9d_blocked, + stdlib_ndarray_mskfilter_t_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_f.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_f.c new file mode 100644 index 000000000000..70bbc9fb66f8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_f.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_f.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_f_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint16_t, float ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint16_t, float ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_f_0d, + stdlib_ndarray_mskfilter_t_f_1d, + stdlib_ndarray_mskfilter_t_f_2d, + stdlib_ndarray_mskfilter_t_f_3d, + stdlib_ndarray_mskfilter_t_f_4d, + stdlib_ndarray_mskfilter_t_f_5d, + stdlib_ndarray_mskfilter_t_f_6d, + stdlib_ndarray_mskfilter_t_f_7d, + stdlib_ndarray_mskfilter_t_f_8d, + stdlib_ndarray_mskfilter_t_f_9d, + stdlib_ndarray_mskfilter_t_f_10d, + stdlib_ndarray_mskfilter_t_f_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_f_2d_blocked, + stdlib_ndarray_mskfilter_t_f_3d_blocked, + stdlib_ndarray_mskfilter_t_f_4d_blocked, + stdlib_ndarray_mskfilter_t_f_5d_blocked, + stdlib_ndarray_mskfilter_t_f_6d_blocked, + stdlib_ndarray_mskfilter_t_f_7d_blocked, + stdlib_ndarray_mskfilter_t_f_8d_blocked, + stdlib_ndarray_mskfilter_t_f_9d_blocked, + stdlib_ndarray_mskfilter_t_f_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_f.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_f( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_f( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_i.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_i.c new file mode 100644 index 000000000000..e6c8a6b13726 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_i.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_i.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_i_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint16_t, int32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_i_0d, + stdlib_ndarray_mskfilter_t_i_1d, + stdlib_ndarray_mskfilter_t_i_2d, + stdlib_ndarray_mskfilter_t_i_3d, + stdlib_ndarray_mskfilter_t_i_4d, + stdlib_ndarray_mskfilter_t_i_5d, + stdlib_ndarray_mskfilter_t_i_6d, + stdlib_ndarray_mskfilter_t_i_7d, + stdlib_ndarray_mskfilter_t_i_8d, + stdlib_ndarray_mskfilter_t_i_9d, + stdlib_ndarray_mskfilter_t_i_10d, + stdlib_ndarray_mskfilter_t_i_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_i_2d_blocked, + stdlib_ndarray_mskfilter_t_i_3d_blocked, + stdlib_ndarray_mskfilter_t_i_4d_blocked, + stdlib_ndarray_mskfilter_t_i_5d_blocked, + stdlib_ndarray_mskfilter_t_i_6d_blocked, + stdlib_ndarray_mskfilter_t_i_7d_blocked, + stdlib_ndarray_mskfilter_t_i_8d_blocked, + stdlib_ndarray_mskfilter_t_i_9d_blocked, + stdlib_ndarray_mskfilter_t_i_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_i.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_i( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_i( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_t.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_t.c new file mode 100644 index 000000000000..3a66f35268c2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_t.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_t.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_t_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint16_t, uint16_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_t_0d, + stdlib_ndarray_mskfilter_t_t_1d, + stdlib_ndarray_mskfilter_t_t_2d, + stdlib_ndarray_mskfilter_t_t_3d, + stdlib_ndarray_mskfilter_t_t_4d, + stdlib_ndarray_mskfilter_t_t_5d, + stdlib_ndarray_mskfilter_t_t_6d, + stdlib_ndarray_mskfilter_t_t_7d, + stdlib_ndarray_mskfilter_t_t_8d, + stdlib_ndarray_mskfilter_t_t_9d, + stdlib_ndarray_mskfilter_t_t_10d, + stdlib_ndarray_mskfilter_t_t_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_t_2d_blocked, + stdlib_ndarray_mskfilter_t_t_3d_blocked, + stdlib_ndarray_mskfilter_t_t_4d_blocked, + stdlib_ndarray_mskfilter_t_t_5d_blocked, + stdlib_ndarray_mskfilter_t_t_6d_blocked, + stdlib_ndarray_mskfilter_t_t_7d_blocked, + stdlib_ndarray_mskfilter_t_t_8d_blocked, + stdlib_ndarray_mskfilter_t_t_9d_blocked, + stdlib_ndarray_mskfilter_t_t_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_t.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 2 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_t( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_t( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_u.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_u.c new file mode 100644 index 000000000000..0af377f584be --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_u.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_u.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_u_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint16_t, uint32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_u_0d, + stdlib_ndarray_mskfilter_t_u_1d, + stdlib_ndarray_mskfilter_t_u_2d, + stdlib_ndarray_mskfilter_t_u_3d, + stdlib_ndarray_mskfilter_t_u_4d, + stdlib_ndarray_mskfilter_t_u_5d, + stdlib_ndarray_mskfilter_t_u_6d, + stdlib_ndarray_mskfilter_t_u_7d, + stdlib_ndarray_mskfilter_t_u_8d, + stdlib_ndarray_mskfilter_t_u_9d, + stdlib_ndarray_mskfilter_t_u_10d, + stdlib_ndarray_mskfilter_t_u_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_u_2d_blocked, + stdlib_ndarray_mskfilter_t_u_3d_blocked, + stdlib_ndarray_mskfilter_t_u_4d_blocked, + stdlib_ndarray_mskfilter_t_u_5d_blocked, + stdlib_ndarray_mskfilter_t_u_6d_blocked, + stdlib_ndarray_mskfilter_t_u_7d_blocked, + stdlib_ndarray_mskfilter_t_u_8d_blocked, + stdlib_ndarray_mskfilter_t_u_9d_blocked, + stdlib_ndarray_mskfilter_t_u_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_u( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_u( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_z.c new file mode 100644 index 000000000000..484b022bda50 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/t_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/t_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_t_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 2 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_t_z_0d, + stdlib_ndarray_mskfilter_t_z_1d, + stdlib_ndarray_mskfilter_t_z_2d, + stdlib_ndarray_mskfilter_t_z_3d, + stdlib_ndarray_mskfilter_t_z_4d, + stdlib_ndarray_mskfilter_t_z_5d, + stdlib_ndarray_mskfilter_t_z_6d, + stdlib_ndarray_mskfilter_t_z_7d, + stdlib_ndarray_mskfilter_t_z_8d, + stdlib_ndarray_mskfilter_t_z_9d, + stdlib_ndarray_mskfilter_t_z_10d, + stdlib_ndarray_mskfilter_t_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_t_z_2d_blocked, + stdlib_ndarray_mskfilter_t_z_3d_blocked, + stdlib_ndarray_mskfilter_t_z_4d_blocked, + stdlib_ndarray_mskfilter_t_z_5d_blocked, + stdlib_ndarray_mskfilter_t_z_6d_blocked, + stdlib_ndarray_mskfilter_t_z_7d_blocked, + stdlib_ndarray_mskfilter_t_z_8d_blocked, + stdlib_ndarray_mskfilter_t_z_9d_blocked, + stdlib_ndarray_mskfilter_t_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/t_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_t_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_t_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_d.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_d.c new file mode 100644 index 000000000000..56a0bd0728c9 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_d.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/u_d.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_u_d_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint32_t, double ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint32_t, double ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_u_d_0d, + stdlib_ndarray_mskfilter_u_d_1d, + stdlib_ndarray_mskfilter_u_d_2d, + stdlib_ndarray_mskfilter_u_d_3d, + stdlib_ndarray_mskfilter_u_d_4d, + stdlib_ndarray_mskfilter_u_d_5d, + stdlib_ndarray_mskfilter_u_d_6d, + stdlib_ndarray_mskfilter_u_d_7d, + stdlib_ndarray_mskfilter_u_d_8d, + stdlib_ndarray_mskfilter_u_d_9d, + stdlib_ndarray_mskfilter_u_d_10d, + stdlib_ndarray_mskfilter_u_d_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_u_d_2d_blocked, + stdlib_ndarray_mskfilter_u_d_3d_blocked, + stdlib_ndarray_mskfilter_u_d_4d_blocked, + stdlib_ndarray_mskfilter_u_d_5d_blocked, + stdlib_ndarray_mskfilter_u_d_6d_blocked, + stdlib_ndarray_mskfilter_u_d_7d_blocked, + stdlib_ndarray_mskfilter_u_d_8d_blocked, + stdlib_ndarray_mskfilter_u_d_9d_blocked, + stdlib_ndarray_mskfilter_u_d_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_d.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_d( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_u.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_u.c new file mode 100644 index 000000000000..d6cc29e1343d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_u.c @@ -0,0 +1,2298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/u_u.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_u_u_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( uint32_t, uint32_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_u_u_0d, + stdlib_ndarray_mskfilter_u_u_1d, + stdlib_ndarray_mskfilter_u_u_2d, + stdlib_ndarray_mskfilter_u_u_3d, + stdlib_ndarray_mskfilter_u_u_4d, + stdlib_ndarray_mskfilter_u_u_5d, + stdlib_ndarray_mskfilter_u_u_6d, + stdlib_ndarray_mskfilter_u_u_7d, + stdlib_ndarray_mskfilter_u_u_8d, + stdlib_ndarray_mskfilter_u_u_9d, + stdlib_ndarray_mskfilter_u_u_10d, + stdlib_ndarray_mskfilter_u_u_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_u_u_2d_blocked, + stdlib_ndarray_mskfilter_u_u_3d_blocked, + stdlib_ndarray_mskfilter_u_u_4d_blocked, + stdlib_ndarray_mskfilter_u_u_5d_blocked, + stdlib_ndarray_mskfilter_u_u_6d_blocked, + stdlib_ndarray_mskfilter_u_u_7d_blocked, + stdlib_ndarray_mskfilter_u_u_8d_blocked, + stdlib_ndarray_mskfilter_u_u_9d_blocked, + stdlib_ndarray_mskfilter_u_u_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_u.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 4 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_u( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_u( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_z.c new file mode 100644 index 000000000000..a1e34b82bbe1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/u_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/u_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_u_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 4 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 16, 8, 4 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_u_z_0d, + stdlib_ndarray_mskfilter_u_z_1d, + stdlib_ndarray_mskfilter_u_z_2d, + stdlib_ndarray_mskfilter_u_z_3d, + stdlib_ndarray_mskfilter_u_z_4d, + stdlib_ndarray_mskfilter_u_z_5d, + stdlib_ndarray_mskfilter_u_z_6d, + stdlib_ndarray_mskfilter_u_z_7d, + stdlib_ndarray_mskfilter_u_z_8d, + stdlib_ndarray_mskfilter_u_z_9d, + stdlib_ndarray_mskfilter_u_z_10d, + stdlib_ndarray_mskfilter_u_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_u_z_2d_blocked, + stdlib_ndarray_mskfilter_u_z_3d_blocked, + stdlib_ndarray_mskfilter_u_z_4d_blocked, + stdlib_ndarray_mskfilter_u_z_5d_blocked, + stdlib_ndarray_mskfilter_u_z_6d_blocked, + stdlib_ndarray_mskfilter_u_z_7d_blocked, + stdlib_ndarray_mskfilter_u_z_8d_blocked, + stdlib_ndarray_mskfilter_u_z_9d_blocked, + stdlib_ndarray_mskfilter_u_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/u_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_u_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_u_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/x_x.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/x_x.c new file mode 100644 index 000000000000..aae03321f5f0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/x_x.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/x_x.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_x_x_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 1 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST( bool, bool ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 4, 2, 1 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST( bool, bool ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_x_x_0d, + stdlib_ndarray_mskfilter_x_x_1d, + stdlib_ndarray_mskfilter_x_x_2d, + stdlib_ndarray_mskfilter_x_x_3d, + stdlib_ndarray_mskfilter_x_x_4d, + stdlib_ndarray_mskfilter_x_x_5d, + stdlib_ndarray_mskfilter_x_x_6d, + stdlib_ndarray_mskfilter_x_x_7d, + stdlib_ndarray_mskfilter_x_x_8d, + stdlib_ndarray_mskfilter_x_x_9d, + stdlib_ndarray_mskfilter_x_x_10d, + stdlib_ndarray_mskfilter_x_x_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_x_x_2d_blocked, + stdlib_ndarray_mskfilter_x_x_3d_blocked, + stdlib_ndarray_mskfilter_x_x_4d_blocked, + stdlib_ndarray_mskfilter_x_x_5d_blocked, + stdlib_ndarray_mskfilter_x_x_6d_blocked, + stdlib_ndarray_mskfilter_x_x_7d_blocked, + stdlib_ndarray_mskfilter_x_x_8d_blocked, + stdlib_ndarray_mskfilter_x_x_9d_blocked, + stdlib_ndarray_mskfilter_x_x_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/x_x.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 2, 1 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 1 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_x_x( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_x_x( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/z_c.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/z_c.c new file mode 100644 index 000000000000..77b6ca708ed5 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/z_c.c @@ -0,0 +1,2300 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/z_c.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_z_c_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 16 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_CAST_FCN( stdlib_complex128_t, stdlib_complex64_t, stdlib_complex128_to_complex64 ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_z_c_0d, + stdlib_ndarray_mskfilter_z_c_1d, + stdlib_ndarray_mskfilter_z_c_2d, + stdlib_ndarray_mskfilter_z_c_3d, + stdlib_ndarray_mskfilter_z_c_4d, + stdlib_ndarray_mskfilter_z_c_5d, + stdlib_ndarray_mskfilter_z_c_6d, + stdlib_ndarray_mskfilter_z_c_7d, + stdlib_ndarray_mskfilter_z_c_8d, + stdlib_ndarray_mskfilter_z_c_9d, + stdlib_ndarray_mskfilter_z_c_10d, + stdlib_ndarray_mskfilter_z_c_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_z_c_2d_blocked, + stdlib_ndarray_mskfilter_z_c_3d_blocked, + stdlib_ndarray_mskfilter_z_c_4d_blocked, + stdlib_ndarray_mskfilter_z_c_5d_blocked, + stdlib_ndarray_mskfilter_z_c_6d_blocked, + stdlib_ndarray_mskfilter_z_c_7d_blocked, + stdlib_ndarray_mskfilter_z_c_8d_blocked, + stdlib_ndarray_mskfilter_z_c_9d_blocked, + stdlib_ndarray_mskfilter_z_c_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_c.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 8 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_c( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_c( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/z_z.c b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/z_z.c new file mode 100644 index 000000000000..6fdb99859ceb --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/src/z_z.c @@ -0,0 +1,2299 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* The following is auto-generated. Do not manually edit. See scripts/loops.js. +*/ + +#include "stdlib/ndarray/base/mskfilter/z_z.h" +#include "stdlib/ndarray/base/mskfilter/typedefs.h" +#include "stdlib/ndarray/base/mskfilter/macros.h" +#include "stdlib/ndarray/base/mskfilter/dispatch_object.h" +#include "stdlib/ndarray/base/mskfilter/dispatch.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/complex/float64/ctor.h" +#include + +/** +* Applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 0; +* +* // Define the array shapes: +* int64_t shx[] = {}; +* int64_t shm[] = {}; +* int64_t shy[] = {}; +* +* // Define the strides: +* int64_t sx[] = { 0 }; +* int64_t sm[] = { 0 }; +* int64_t sy[] = { 0 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shx, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shy, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_0d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_0d( struct ndarray *arrays[] ) { + int8_t status = stdlib_ndarray_mskfilter_z_z_0d( arrays ); + if ( status != 0 ) { + return -1; + } + return 0; +} + +/** +* Applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 1; +* +* // Define the array shapes: +* int64_t shx[] = { 3 }; +* int64_t shm[] = { 3 }; +* int64_t shy[] = { 3 }; +* +* // Define the strides: +* int64_t sx[] = { 16 }; +* int64_t sm[] = { 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_1d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_1d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_1D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_2d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_2d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_2d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_2d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_2D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_3d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_3d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_3d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_3d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_3D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_4d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_4d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 4; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_4d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_4d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_4D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_5d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_5d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 5; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_5d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_5d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_5D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_6d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_6d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 6; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_6d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_6d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_6D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_7d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_7d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 7; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_7d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_7d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_7D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_8d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_8d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 8; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_8d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_8d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_8D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_9d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_9d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 9; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_9d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_9d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_9D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_10d( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_10d( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 10; +* +* // Define the array shapes: +* int64_t shx[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shm[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; +* int64_t sm[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_10d_blocked( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_10d_blocked( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_10D_BLOCKED_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +/** +* Applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 3; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2, 2 }; +* int64_t shm[] = { 2, 2, 2 }; +* int64_t shy[] = { 8 }; +* +* // Define the strides: +* int64_t sx[] = { 64, 32, 16 }; +* int64_t sm[] = { 4, 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z_nd( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z_nd( struct ndarray *arrays[] ) { + STDLIB_NDARRAY_MSKFILTER_ND_LOOP_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) + return 0; +} + +// Define a list of unary ndarray functions: +static ndarrayUnarymskfilterFcn functions[] = { + stdlib_ndarray_mskfilter_z_z_0d, + stdlib_ndarray_mskfilter_z_z_1d, + stdlib_ndarray_mskfilter_z_z_2d, + stdlib_ndarray_mskfilter_z_z_3d, + stdlib_ndarray_mskfilter_z_z_4d, + stdlib_ndarray_mskfilter_z_z_5d, + stdlib_ndarray_mskfilter_z_z_6d, + stdlib_ndarray_mskfilter_z_z_7d, + stdlib_ndarray_mskfilter_z_z_8d, + stdlib_ndarray_mskfilter_z_z_9d, + stdlib_ndarray_mskfilter_z_z_10d, + stdlib_ndarray_mskfilter_z_z_nd +}; + +// Define a list of unary ndarray functions implementing loop blocking... +static ndarrayUnarymskfilterFcn blocked_functions[] = { + stdlib_ndarray_mskfilter_z_z_2d_blocked, + stdlib_ndarray_mskfilter_z_z_3d_blocked, + stdlib_ndarray_mskfilter_z_z_4d_blocked, + stdlib_ndarray_mskfilter_z_z_5d_blocked, + stdlib_ndarray_mskfilter_z_z_6d_blocked, + stdlib_ndarray_mskfilter_z_z_7d_blocked, + stdlib_ndarray_mskfilter_z_z_8d_blocked, + stdlib_ndarray_mskfilter_z_z_9d_blocked, + stdlib_ndarray_mskfilter_z_z_10d_blocked +}; + +// Create a unary function dispatch object: +static const struct ndarrayUnarymskfilterDispatchObject obj = { + // Array containing unary ndarray functions: + functions, + + // Number of unary ndarray functions: + 12, + + // Array containing unary ndarray functions using loop blocking: + blocked_functions, + + // Number of unary ndarray functions using loop blocking: + 9 +}; + +/** +* Applies a mask to a provided input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray. +* +* ## Notes +* +* - If successful, the functions returns `0`; otherwise, the function returns an error code. +* +* @param arrays array whose first element is a pointer to an input ndarray, whose second element is a pointer to a mask ndarray, and whose third element is a pointer to an output ndarray +* @return status code +* +* @example +* #include "stdlib/ndarray/base/mskfilter/z_z.h" +* #include "stdlib/ndarray/dtypes.h" +* #include "stdlib/ndarray/index_modes.h" +* #include "stdlib/ndarray/orders.h" +* #include "stdlib/ndarray/ctor.h" +* #include +* #include +* #include +* +* // Define the ndarray data types: +* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; +* enum STDLIB_NDARRAY_DTYPE mdtype = STDLIB_NDARRAY_UINT8; +* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; +* +* // Create underlying byte arrays: +* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* uint8_t mbuf[] = { 0, 0, 0, 0 }; +* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +* +* // Define the number of dimensions: +* int64_t ndims = 2; +* +* // Define the array shapes: +* int64_t shx[] = { 2, 2 }; +* int64_t shm[] = { 2, 2 }; +* int64_t shy[] = { 4 }; +* +* // Define the strides: +* int64_t sx[] = { 32, 16 }; +* int64_t sm[] = { 2, 1 }; +* int64_t sy[] = { 16 }; +* +* // Define the offsets: +* int64_t ox = 0; +* int64_t om = 0; +* int64_t oy = 0; +* +* // Define the array order: +* enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; +* +* // Specify the index mode: +* enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; +* +* // Specify the subscript index modes: +* int8_t submodes[] = { imode }; +* int64_t nsubmodes = 1; +* +* // Create an input ndarray: +* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); +* if ( x == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an mask ndarray: +* struct ndarray *mask = stdlib_ndarray_allocate( mdtype, mbuf, ndims, shm, sm, om, order, imode, nsubmodes, submodes ); +* if ( mask == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an output ndarray: +* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, 1, shape, sy, oy, order, imode, nsubmodes, submodes ); +* if ( y == NULL ) { +* fprintf( stderr, "Error allocating memory.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // Create an array containing the ndarrays: +* struct ndarray *arrays[] = { x, mask, y }; +* +* // Apply mask to array: +* int8_t status = stdlib_ndarray_mskfilter_z_z( arrays ); +* if ( status != 0 ) { +* fprintf( stderr, "Error during computation.\n" ); +* exit( EXIT_FAILURE ); +* } +* +* // ... +* +* // Free allocated memory: +* stdlib_ndarray_free( x ); +* stdlib_ndarray_free( mask ); +* stdlib_ndarray_free( y ); +*/ +int8_t stdlib_ndarray_mskfilter_z_z( struct ndarray *arrays[] ) { + return stdlib_ndarray_unary_mskfilter_dispatch( &obj, arrays ); +} diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.0d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.0d.js new file mode 100644 index 000000000000..c652360dbfcc --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.0d.js @@ -0,0 +1,98 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray', function test( t ) { + var expected; + var mask; + var x; + var y; + + // mask having truthy value + x = new ndarray( 'float64', new Float64Array( [ 5.0 ] ), [], [ 0 ], 0, 'row-major' ); + mask = new ndarray( 'uint8', new Uint8Array( [ 1 ] ), [], [ 0 ], 0, 'row-major' ); + y = new ndarray( 'float64', new Float64Array( [ 0.0 ] ), [ 1 ], [ 0 ], 0, 'row-major' ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + // mask having falsy value + x = new ndarray( 'float64', new Float64Array( [ 5.0 ] ), [], [ 0 ], 0, 'row-major' ); + mask = new ndarray( 'uint8', new Uint8Array( [ 0 ] ), [], [ 0 ], 0, 'row-major' ); + y = new ndarray( 'float64', new Float64Array( [ 0.0 ] ), [ 1 ], [ 0 ], 0, 'row-major' ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 0-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (accessors)', function test( t ) { + var expected; + var mask; + var x; + var y; + + // mask having truthy value + x = new ndarray( 'complex64', new Complex64Array( [ 5.0, 5.0 ] ), [], [ 0 ], 0, 'row-major' ); + mask = new ndarray( 'bool', new BooleanArray( [ 1 ] ), [], [ 0 ], 0, 'row-major' ); + y = new ndarray( 'complex64', new Complex64Array( [ 0.0, 0.0 ] ), [ 1 ], [ 0 ], 0, 'row-major' ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 5.0, 5.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + // mask having falsy value + x = new ndarray( 'complex64', new Complex64Array( [ 5.0, 5.0 ] ), [], [ 0 ], 0, 'row-major' ); + mask = new ndarray( 'bool', new BooleanArray( [ 0 ] ), [], [ 0 ], 0, 'row-major' ); + y = new ndarray( 'complex64', new Complex64Array( [ 0.0, 0.0 ] ), [ 1 ], [ 0 ], 0, 'row-major' ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.10d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.10d.js new file mode 100644 index 000000000000..34e9c607fb22 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.10d.js @@ -0,0 +1,2436 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ 32, 16, 16, -16, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, 32, 16, -16, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, bsize*32, 16, -8, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -16, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; + st = [ bsize*32, bsize*32, bsize*32, -bsize*16, 8, 4, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ bsize*32, bsize*32, bsize*32, -bsize*32, bsize*16, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -bsize*32, bsize*32, bsize*16, -8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -bsize*32, bsize*32, bsize*32, -bsize*16, 8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -bsize*32, bsize*16, bsize*16, -bsize*16, bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; + st = [ bsize*32, bsize*32, bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*8, bsize*8, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 25.0, 26.0, 17.0, 18.0, 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ 32, 16, 16, -16, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, 32, 16, -16, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, bsize*32, 16, -8, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -16, 8, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; + st = [ bsize*32, bsize*32, bsize*32, -bsize*16, 8, 4, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ bsize*32, bsize*32, bsize*32, -bsize*32, bsize*16, 8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -bsize*32, bsize*32, bsize*16, -8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -bsize*32, bsize*32, bsize*32, -bsize*16, 8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ bsize*64, bsize*64, bsize*32, -bsize*32, bsize*16, bsize*16, -bsize*16, bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; + st = [ bsize*32, bsize*32, bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*8, bsize*8, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -1, -1, -1, -1, -1, -1, -1, -2, -4, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ 2, bsize*4, bsize*8, -bsize*8, bsize*8, bsize*16, bsize*16, -bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ 2, 4, bsize*8, bsize*16, bsize*16, bsize*32, bsize*32, bsize*64, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*64, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*64, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; + st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ 2, 4, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 2, bsize*2, 2, 1 ]; + st = [ 2, 4, 4, 8, 8, 16, 16, 32, bsize*64, bsize*128 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, 16, 16, 32, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 16, -16, 16, 16, 32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = [ -1, -1, -1, -1, -1, -1, -2, -4, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, -1, 1, -1, 1, 1, -4, -8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0, 25.0, 26.0, 17.0, 18.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ 2, bsize*4, bsize*8, -bsize*8, bsize*8, bsize*16, bsize*16, -bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; + st = [ 2, 4, bsize*8, bsize*16, bsize*16, bsize*32, bsize*32, bsize*64, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*64, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*64, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; + st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ 2, 4, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 2, bsize*2, 2, 1 ]; + st = [ 2, 4, 4, 8, 8, 16, 16, 32, bsize*64, bsize*128 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, 16, 16, 32, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 10-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 16, -16, 16, 16, 32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.1d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.1d.js new file mode 100644 index 000000000000..6ae4fc3a85af --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.1d.js @@ -0,0 +1,76 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray', function test( t ) { + var expected; + var mask; + var x; + var y; + + x = new ndarray( 'float64', new Float64Array( [ 1.0, 2.0, 3.0 ] ), [ 3 ], [ 1 ], 0, 'row-major' ); + mask = new ndarray( 'uint8', new Uint8Array( [ 1, 0, 1 ] ), [ 3 ], [ 1 ], 0, 'row-major' ); + y = new ndarray( 'float64', new Float64Array( [ 0.0, 0.0 ] ), [ 2 ], [ 1 ], 0, 'row-major' ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 1-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (accessors)', function test( t ) { + var expected; + var mask; + var x; + var y; + + x = new ndarray( 'complex64', new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ), [ 3 ], [ 1 ], 0, 'row-major' ); + mask = new ndarray( 'bool', new BooleanArray( [ 1, 0, 1 ] ), [ 3 ], [ 1 ], 0, 'row-major' ); + y = new ndarray( 'complex64', new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ), [ 2 ], [ 1 ], 0, 'row-major' ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.2d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.2d.js new file mode 100644 index 000000000000..5fe97ea0e1e1 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.2d.js @@ -0,0 +1,1123 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ bsize*4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ bsize*4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -1, -2 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 1, 4 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 1, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ 2, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ -2, 4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -1, -2 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 1, 4 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 1, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ 2, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 2-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ -2, 4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.3d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.3d.js new file mode 100644 index 000000000000..6aab72fad926 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.3d.js @@ -0,0 +1,1287 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2, 2 ]; + st = [ -4, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ 3, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ -3, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ -4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ -bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2 ]; + st = [ bsize*8, bsize*4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2, 2 ]; + st = [ -4, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ 3, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ -3, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ -4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ -bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2 ]; + st = [ bsize*8, bsize*4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 2 ]; + st = [ -1, -2, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 1, 2, 3 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ -1, -2, 3 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2 ]; + st = [ 2, -4, -4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1 ]; + st = [ 2, -4, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ -2, bsize*4, bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 2 ]; + st = [ -1, -2, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 1, 2, 3 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ -1, -2, 3 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1 ]; + st = [ 2, -bsize*4, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1 ]; + st = [ -2, 4, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 3-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2 ]; + st = [ 2, -4, 4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.4d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.4d.js new file mode 100644 index 000000000000..2b8710da65a3 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.4d.js @@ -0,0 +1,1451 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2, 1, 2 ]; + st = [ -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 4, 2, 1, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 4, -2, -1, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1 ]; + st = [ -4, -4, 2, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2, 1 ]; + st = [ -bsize*8, -4, 2, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2, 1 ]; + st = [ bsize*8, bsize*4, -2, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, 1, bsize*2 ]; + st = [ bsize*8, bsize*4, bsize*4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2, 1, 2 ]; + st = [ -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 4, 2, 1, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 4, -2, -1, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1 ]; + st = [ -4, -4, 2, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2, 1 ]; + st = [ -bsize*8, -4, 2, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1 ]; + st = [ -bsize*4, bsize*4, -2, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2 ]; + st = [ -bsize*4, bsize*4, -bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 1, 2 ]; + st = [ -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 1, 2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 1, -2, -4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, 1, bsize*2 ]; + st = [ 2, 2, -4, -4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2, 1 ]; + st = [ 2, 2, -4, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 1, 2 ]; + st = [ 2, 2, -bsize*4, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 1, 2 ]; + st = [ 2, -bsize*4, bsize*4, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 1, 2 ]; + st = [ -1, -2, -4, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 1, 2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1 ]; + st = [ 1, 2, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 2 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1 ]; + st = [ 2, -bsize*4, -bsize*4, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1 ]; + st = [ 1, 2, -bsize*4, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1 ]; + st = [ 2, 4, -4, -bsize*4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 4-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*4 ]; + st = [ 2, 4, -4, -4 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.5d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.5d.js new file mode 100644 index 000000000000..c1c9f85878a8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.5d.js @@ -0,0 +1,1616 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 2, 1, 2, 2 ]; + st = [ -8, -4, -4, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 8 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 8 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 15.0, 13.0, 11.0, 9.0, 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 8, 4, 2, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 3 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 9.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 8, 4, -2, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 3 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 3.0, 1.0, 11.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2 ]; + st = [ 8, -8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 2 ]; + st = [ bsize*8, -4, 4, -4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2 ]; + st = [ bsize*8, bsize*8, -4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 1 ]; + st = [ bsize*8, -bsize*8, -bsize*4, -2, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2 ]; + st = [ bsize*8, -bsize*8, -bsize*4, -bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ -4, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 8, 4, 2, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 24, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 17.0, 18.0, 21.0, 22.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 8, 4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 24, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 5.0, 6.0, 1.0, 2.0, 21.0, 22.0, 17.0, 18.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2 ]; + st = [ 8, -8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 2 ]; + st = [ bsize*8, -4, 4, -4, -2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2 ]; + st = [ bsize*8, bsize*8, -4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 2 ]; + st = [ bsize*8, -bsize*8, -bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2 ]; + st = [ bsize*8, -bsize*8, -bsize*4, -bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 4 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 1, 2, 2 ]; + st = [ -1, -2, -4, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 8 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 8 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 15.0, 13.0, 11.0, 9.0, 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 1, 2, 2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 3 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 9.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 1, 2, -2, -4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 3 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 3.0, 1.0, 11.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2 ]; + st = [ -2, bsize*4, -bsize*4, bsize*8, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 2 ]; + st = [ -2, 4, -bsize*8, bsize*8, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2 ]; + st = [ -2, 4, -4, bsize*8, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 2 ]; + st = [ -2, 4, -4, 4, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2 ]; + st = [ -2, 4, -4, 8, 8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ -1, -2, -2, -4, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 1, 2, 2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 24, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 17.0, 18.0, 21.0, 22.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2 ]; + st = [ 1, 2, -2, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 24, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 21.0, 22.0, 17.0, 18.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2 ]; + st = [ -2, bsize*4, -bsize*4, bsize*8, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1 ]; + st = [ -2, 4, -bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2 ]; + st = [ -2, 4, -4, bsize*8, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 2 ]; + st = [ -2, -4, -4, 4, bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 5-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2 ]; + st = [ 2, 4, -4, 8, -8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.6d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.6d.js new file mode 100644 index 000000000000..7ca99914d882 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.6d.js @@ -0,0 +1,1780 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 8, 4, 4, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 16, -16, 8, -4, 4, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 5.0, 1.0, 13.0, 9.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2 ]; + st = [ 8, -8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2 ]; + st = [ bsize*8, -4, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2 ]; + st = [ bsize*8, -bsize*8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2 ]; + st = [ bsize*8, -bsize*8, -bsize*8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 1, bsize*2, 2 ]; + st = [ bsize*8, -bsize*8, -bsize*8, bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2 ]; + st = [ bsize*8, -bsize*8, -bsize*4, bsize*4, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 8, 4, 4, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 8, -4, -4, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0, 25.0, 26.0, 17.0, 18.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2 ]; + st = [ 8, -8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2 ]; + st = [ bsize*8, -4, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2 ]; + st = [ bsize*8, -bsize*8, -4, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2 ]; + st = [ bsize*8, -bsize*8, -bsize*8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 1, bsize*2, 2 ]; + st = [ bsize*8, -bsize*8, -bsize*8, bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2 ]; + st = [ bsize*8, -bsize*8, -bsize*4, bsize*4, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ -1, -1, -1, -2, -4, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 9.0, 11.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 1, -1, 1, -2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 3.0, 1.0, 11.0, 9.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, bsize*4, bsize*4, -bsize*4, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2 ]; + st = [ 2, 4, bsize*8, -bsize*8, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, -bsize*8, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, -4, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 1 ]; + st = [ 2, 4, 4, -4, 8, -bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2 ]; + st = [ 2, 4, 4, -8, 8, -8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ -1, -1, -1, -2, -4, -4 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 2, 4, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 17.0, 18.0, 21.0, 22.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, -2, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 21.0, 22.0, 17.0, 18.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2 ]; + st = [ 2, bsize*4, bsize*4, -bsize*8, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2 ]; + st = [ 2, 4, bsize*8, -bsize*8, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, -bsize*8, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, -4, bsize*8, -bsize*8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 1 ]; + st = [ 2, 4, 4, -4, 8, -bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 6-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2 ]; + st = [ 2, 4, 4, -8, 8, -8 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.7d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.7d.js new file mode 100644 index 000000000000..ff6369174549 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.7d.js @@ -0,0 +1,1944 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -16, 16, -16, 8, -4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 5.0, 1.0, 13.0, 9.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; + st = [ 16, -16, 8, 8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 2, 1, 1, 2 ]; + st = [ bsize*16, -8, 8, 4, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ bsize*16, -bsize*16, 8, 8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 1, 1, 2 ]; + st = [ bsize*16, -bsize*16, bsize*8, 4, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; + st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 2 ]; + st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; + st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*4, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 2, 1, 2, 1, 2, 1, 2 ]; + st = [ -8, -8, -4, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 8 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 8 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 29.0, 30.0, 25.0, 26.0, 21.0, 22.0, 17.0, 18.0, 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -16, 16, -16, -8, 4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 17.0, 18.0, 25.0, 26.0, 1.0, 2.0, 9.0, 10.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; + st = [ 16, -16, 8, 8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ bsize*16, -8, 8, 8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ bsize*16, -bsize*16, 8, 8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 1, 1, 2 ]; + st = [ bsize*16, -bsize*16, bsize*8, 4, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; + st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, 1, bsize*2, 2 ]; + st = [ bsize*16, -bsize*16, bsize*16, bsize*8, -bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; + st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*4, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2, 1, 2 ]; + st = [ -1, -2, -2, -4, -4, -8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 15.0, 13.0, 11.0, 9.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 2, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, -1, 2, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 15.0, 9.0, 11.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; + st = [ 2, -bsize*4, bsize*4, bsize*8, -bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 2, 1, 2, 1 ]; + st = [ 2, -4, bsize*8, bsize*8, -bsize*16, bsize*16, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, -4, -4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 2, 1, 2 ]; + st = [ 2, -4, -4, 4, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; + st = [ 2, -4, -4, 8, 8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 2 ]; + st = [ 2, -4, -4, 8, 8, 8, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; + st = [ 2, -4, -4, 8, 8, 16, 16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 1, 2, 1, 2, 1, 2 ]; + st = [ -1, -2, -2, -4, -4, -8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 8 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 8 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 29.0, 30.0, 25.0, 26.0, 21.0, 22.0, 17.0, 18.0, 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 2, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 8 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 8 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0, 17.0, 18.0, 21.0, 22.0, 25.0, 26.0, 29.0, 30.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -1, 1, -1, -2, 4, -8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 8 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 8 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 5.0, 6.0, 1.0, 2.0, 13.0, 14.0, 9.0, 10.0, 21.0, 22.0, 17.0, 18.0, 29.0, 30.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; + st = [ 2, -bsize*4, -bsize*4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, -4, -bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, -4, -4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2, 2 ]; + st = [ 2, -4, -4, 4, bsize*8, bsize*8, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; + st = [ 2, -4, -4, 8, 8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 2 ]; + st = [ 2, -4, -4, 8, 8, 8, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 7-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; + st = [ 2, -4, -4, 8, 8, 16, 16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.8d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.8d.js new file mode 100644 index 000000000000..a2af835aff38 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.8d.js @@ -0,0 +1,2108 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 2 ]; + st = [ 32, -16, 8, -8, -8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 2 ]; + st = [ -bsize*32, -16, 8, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 2, 1, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, 16, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*32, -16, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 2, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -bsize*16, 8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*4, -bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 25.0, 26.0, 17.0, 18.0, 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 2 ]; + st = [ 32, 16, 8, -8, -8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 2 ]; + st = [ -bsize*32, -16, 8, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 2, 1, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, 16, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*32, -16, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 2, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -bsize*16, 8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*4, -bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = [ -1, -1, -1, -1, -2, -4, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, -1, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; + st = [ 2, bsize*4, bsize*4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; + st = [ 2, -4, bsize*8, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*16, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 2, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, 16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, 32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = [ -1, -1, -1, -1, -2, -4, -4, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -1, 1, -1, 1, 1, -4, -8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0, 25.0, 26.0, 17.0, 18.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; + st = [ 2, bsize*4, bsize*4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; + st = [ 2, -4, bsize*8, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*16, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 2, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, 16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 8-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, 32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.9d.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.9d.js new file mode 100644 index 000000000000..55079382897f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.9d.js @@ -0,0 +1,2272 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-lines */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var ones = require( '@stdlib/array/ones' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ 32, -16, -8, 8, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ bsize*32, -16, -8, 8, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, -bsize*32, -16, 8, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 2, 1, 1, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, 16, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, bsize*16, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, bsize*32, bsize*16, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, bsize*32, bsize*32, -bsize*16, 8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; + st = [ -bsize*32, -bsize*32, -bsize*16, bsize*16, bsize*16, -bsize*16, bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2 ]; + st = [ -bsize*32, -bsize*32, -bsize*16, bsize*16, bsize*8, -bsize*8, bsize*8, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 25.0, 26.0, 17.0, 18.0, 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ 32, -16, -8, 8, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ bsize*32, -16, -8, 8, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; + st = [ bsize*64, -bsize*32, -16, 8, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 2, 1, 1, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, 16, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, bsize*16, 8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, bsize*32, bsize*16, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; + st = [ bsize*64, -bsize*64, -bsize*32, bsize*32, bsize*32, -bsize*16, 8, -4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; + st = [ -bsize*32, -bsize*32, -bsize*16, bsize*16, bsize*16, -bsize*16, bsize*8, 4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2 ]; + st = [ -bsize*32, -bsize*32, -bsize*16, bsize*16, bsize*8, -bsize*8, bsize*8, bsize*4, 2 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, empty)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 1, 2, 1, 1, 1, 1, 1 ]; + st = [ -1, -2, -4, -4, -8, -8, -8, -8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 8, 'float64' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( 4 ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 7.0, 5.0, 3.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ 2, bsize*4, bsize*8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1, 1, 1, 1, 2 ]; + st = [ 2, 4, bsize*8, bsize*16, bsize*16, bsize*16, bsize*16, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 1, 1, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 8, 16, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 8, 16, 32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'uint8' ); + ybuf = new Float64Array( len ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 2, 2, 1, 2, 1, 1, 1, 1, 1 ]; + st = [ -1, -2, -4, -4, -8, -8, -8, -8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 13.0, 14.0, 9.0, 10.0, 5.0, 6.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, -1, 1, -1, 1, 1, -4, -8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0, 25.0, 26.0, 17.0, 18.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; + st = [ 2, bsize*4, bsize*8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 2, 1, 1, 1, 1, 1, 2 ]; + st = [ 2, 4, bsize*8, bsize*16, bsize*16, bsize*16, bsize*16, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 2, bsize*2, 2, 1, 1, 1, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; + st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 8, 16, bsize*32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided 9-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var xbuf; + var mbuf; + var ybuf; + var mask; + var len; + var ord; + var sh; + var st; + var dt; + var o; + var x; + var y; + + dt = 'complex64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, 2, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 8, 16, 32 ]; + o = strides2offset( sh, st ); + len = numel( sh ); + + xbuf = ones( len*2, dt ); + mbuf = ones( len*2, 'bool' ); + ybuf = new Complex64Array( len ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ len ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = ones( len, dt ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.js new file mode 100644 index 000000000000..88ec44709f1d --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.js @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.nd.js b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.nd.js new file mode 100644 index 000000000000..a004ae450ab7 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/mskfilter/test/test.nd.js @@ -0,0 +1,589 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Uint8Array = require( '@stdlib/array/uint8' ); +var BooleanArray = require( '@stdlib/array/bool' ); +var oneTo = require( '@stdlib/array/one-to' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var mskfilter = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mskfilter, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 25.0, 26.0, 17.0, 18.0, 9.0, 10.0, 1.0, 2.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var mask; + var xbuf; + var mbuf; + var ybuf; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new BooleanArray( [ 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 2 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 3.0, 5.0, 7.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 1.0, 5.0, 9.0, 13.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + xbuf = new Float64Array( oneTo( 16, 'float32' ) ); + mbuf = new Uint8Array( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'float64', xbuf, sh, st, o, ord ); + mask = ndarray( 'uint8', mbuf, sh, st, o, ord ); + y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Float64Array( [ 13.0, 9.0, 5.0, 1.0 ] ); + t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 16, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 5.0, 6.0, 9.0, 10.0, 13.0, 14.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 1.0, 2.0, 9.0, 10.0, 17.0, 18.0, 25.0, 26.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a mask to a provided n-dimensional input ndarray and assigns unmasked values to elements in a provided one-dimensional output ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var xbuf; + var mbuf; + var ybuf; + var mask; + var ord; + var sh; + var st; + var o; + var x; + var y; + + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, -1, 1, -1, 1, 1, -4, -8, 8 ]; + o = strides2offset( sh, st ); + + xbuf = new Complex64Array( oneTo( 32, 'float32' ) ); + mbuf = new BooleanArray( [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ] ); + ybuf = new Complex64Array( 4 ); + + x = ndarray( 'complex64', xbuf, sh, st, o, ord ); + mask = ndarray( 'bool', mbuf, sh, st, o, ord ); + y = ndarray( 'complex64', ybuf, [ 4 ], [ 1 ], 0, ord ); + + mskfilter( [ x, mask, y ] ); + + expected = new Complex64Array( [ 9.0, 10.0, 1.0, 2.0, 25.0, 26.0, 17.0, 18.0 ] ); + t.strictEqual( isSameComplex64Array( y.data, expected ), true, 'returns expected value' ); + + t.end(); +});