npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@stdlib/strided-base-mskunary

v0.3.0

Published

Apply a unary callback to elements in a strided input array according to elements in a strided mask array and assign results to elements in a strided output array.

Downloads

192

Readme

mskunary

[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]

Apply a unary callback to elements in a strided input array according to elements in a strided mask array and assign results to elements in a strided output array.

Installation

npm install @stdlib/strided-base-mskunary

Usage

var mskunary = require( '@stdlib/strided-base-mskunary' );

mskunary( arrays, shape, strides, fcn )

Applies a unary callback to elements in a strided input array according to elements in a strided mask array and assigns results to elements in a strided output array.

var Float64Array = require( '@stdlib/array-float64' );
var Uint8Array = require( '@stdlib/array-uint8' );
var abs = require( '@stdlib/math-base-special-abs' );

var x = new Float64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] );
var mask = new Uint8Array( [ 0, 0, 0, 1, 0, 0, 0, 1 ] );

// Compute the absolute values in-place:
mskunary( [ x, mask, x ], [ x.length ], [ 1, 1, 1 ], abs );
// x => <Float64Array>[ 2.0, 1.0, 3.0, -5.0, 4.0, 0.0, 1.0, -3.0 ]

The function accepts the following arguments:

  • arrays: array-like object containing one strided input array, a strided mask array, and one strided output array.
  • shape: array-like object containing a single element, the number of indexed elements.
  • strides: array-like object containing the stride lengths for the strided arrays.
  • fcn: unary function to apply.

The shape and strides parameters determine which elements in the strided arrays are accessed at runtime. For example, to index every other value in the strided input array and to index the first N elements of the strided output array in reverse order,

var Float64Array = require( '@stdlib/array-float64' );
var Uint8Array = require( '@stdlib/array-uint8' );
var abs = require( '@stdlib/math-base-special-abs' );

var x = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] );
var mask = new Uint8Array( [ 0, 1, 0, 0, 0, 0 ] );
var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

mskunary( [ x, mask, y ], [ 3 ], [ 2, 1, -1 ], abs );
// y => <Float64Array>[ 5.0, 0.0, 1.0, 0.0, 0.0, 0.0 ]

Note that indexing is relative to the first index. To introduce an offset, use [typed array][mdn-typed-array] views.

var Float64Array = require( '@stdlib/array-float64' );
var Uint8Array = require( '@stdlib/array-uint8' );
var abs = require( '@stdlib/math-base-special-abs' );

// Initial arrays...
var x0 = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] );
var m0 = new Uint8Array( [ 0, 0, 0, 0, 0, 1 ] );
var y0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

// Create offset views...
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var m1 = new Uint8Array( m0.buffer, m0.BYTES_PER_ELEMENT*3 ); // start at 4th element
var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element

mskunary( [ x1, m1, y1 ], [ 3 ], [ -2, 1, 1 ], abs );
// y0 => <Float64Array>[ 0.0, 0.0, 0.0, 6.0, 4.0, 0.0 ]

mskunary.ndarray( arrays, shape, strides, offsets, fcn )

Applies a unary callback to elements in a strided input array according to elements in a strided mask array and assigns results to elements in a strided output array using alternative indexing semantics.

var Float64Array = require( '@stdlib/array-float64' );
var Uint8Array = require( '@stdlib/array-uint8' );
var abs = require( '@stdlib/math-base-special-abs' );

var x = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0 ] );
var mask = new Uint8Array( [ 0, 0, 1, 0, 0 ] );
var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );

mskunary.ndarray( [ x, mask, y ], [ x.length ], [ 1, 1, 1 ], [ 0, 0, 0 ], abs );
// y => <Float64Array>[ 1.0, 2.0, 0.0, 4.0, 5.0 ]

The function accepts the following additional arguments:

  • offsets: array-like object containing the starting indices (i.e., index offsets) for the strided arrays.

While [typed array][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offsets parameter supports indexing semantics based on starting indices. For example, to index every other value in the strided input array starting from the second value and to index the last N elements in the strided output array,

var Float64Array = require( '@stdlib/array-float64' );
var Uint8Array = require( '@stdlib/array-uint8' );
var abs = require( '@stdlib/math-base-special-abs' );

var x = new Float64Array( [ -1.0, -2.0, -3.0, -4.0, -5.0, -6.0 ] );
var mask = new Uint8Array( [ 0, 1, 0, 0, 0, 0 ] );
var y = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

mskunary.ndarray( [ x, mask, y ], [ 3 ], [ 2, 1, -1 ], [ 1, 0, y.length-1 ], abs );
// y => <Float64Array>[ 0.0, 0.0, 0.0, 6.0, 0.0, 2.0 ]

Examples

var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
var bernoulli = require( '@stdlib/random-base-bernoulli' ).factory;
var filledarray = require( '@stdlib/array-filled' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var mskunary = require( '@stdlib/strided-base-mskunary' );

function add10( x ) {
    return x + 10;
}

var N = 10;

var x = filledarrayBy( N, 'generic', discreteUniform( -100, 100 ) );
console.log( x );

var m = filledarrayBy( N, 'generic', bernoulli( 0.5 ) );
console.log( m );

var y = filledarray( 0.0, N, 'generic' );
console.log( y );

var shape = [ N ];
var strides = [ 1, 1, -1 ];
var offsets = [ 0, 0, N-1 ];

mskunary.ndarray( [ x, m, y ], shape, strides, offsets, add10 );
console.log( y );

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:

stdlib_strided_mask_<input_data_type>_<output_data_type>[_as_<callback_arg_data_type>_<callback_return_data_type>]

For example,

void stdlib_strided_mask_d_d(...) {...}

is a function which accepts one double-precision floating-point strided input array and one double-precision floating-point strided output array. In other words, the suffix encodes the function type signature.

To support callbacks whose input arguments and/or return values are of a different data type than the strided input and/or output array data types, the naming convention supports appending an as suffix. For example,

void stdlib_strided_mask_f_f_as_d_d(...) {...}

is a function which accepts one single-precision floating-point strided input array and one single-precision floating-point strided output array. However, the callback accepts and returns double-precision floating-point numbers. Accordingly, the input and output values need to be cast using the following conversion sequence

// Convert each input array element to double-precision:
double in1 = (double)x[ i ];

// Evaluate the callback:
double out = f( in1 );

// Convert the callback return value to single-precision:
y[ i ] = (float)out;

When the strided input array and the callback (i.e., the input argument and return value) share the same data type, the as suffix can be omitted. For example,

void stdlib_strided_mask_f_d(...) {...}

is a function which accepts one single-precision floating-point strided input array and one double-precision floating-point strided output array. The callback is assumed to accept and return single-precision floating-point numbers. Accordingly, the input and output values are cast according to the following conversion sequence

// Retrieve each input array element as single-precision:
float in1 = (float)x[ i ];

// Evaluate the callback:
float out = f( in1 );

// Convert the callback return value to double-precision:
y[ i ] = (double)out;

Usage

#include "stdlib/strided/base/mskunary.h"

stdlib_strided_mask_b_b( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 1 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_b( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_b( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_b_as_u_u( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 1 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint32_t fcn( uint32_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_b_as_u_u( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint32_t (*f)(uint32_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_b_as_u_u( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_c( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_c( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_c( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_c_as_b_c( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float32/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex64_t fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_c_as_b_c( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex64_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_c_as_b_c( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_c_as_c_c( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float32/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex64_t fcn( stdlib_complex64_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_c_as_c_c( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex64_t (*f)(stdlib_complex64_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_c_as_c_c( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_c_as_z_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float64/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex128_t fcn( stdlib_complex128_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_c_as_z_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex128_t (*f)(stdlib_complex128_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_c_as_z_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_d( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_d( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_d( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_d_as_b_d( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static double fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_d_as_b_d( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a double (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_d_as_b_d( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_d_as_d_d( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static double fcn( double x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_d_as_d_d( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a double (*f)(double) function to apply provided as a void pointer.
void stdlib_strided_mask_b_d_as_d_d( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_f( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_f( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_f( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_f_as_b_f( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static float fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_f_as_b_f( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a float (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_f_as_b_f( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_f_as_d_d( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static double fcn( double x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_f_as_d_d( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a double (*f)(double) function to apply provided as a void pointer.
void stdlib_strided_mask_b_f_as_d_d( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_f_as_f_f( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static float fcn( float x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_f_as_f_f( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a float (*f)(float) function to apply provided as a void pointer.
void stdlib_strided_mask_b_f_as_f_f( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_i( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_i( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_i( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_i_as_b_i( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static int32_t fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_i_as_b_i( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a int32_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_i_as_b_i( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_i_as_i_i( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static int32_t fcn( int32_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_i_as_i_i( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a int32_t (*f)(int32_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_i_as_i_i( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_k( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_k( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_k( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_k_as_b_k( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static int16_t fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_k_as_b_k( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a int16_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_k_as_b_k( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_k_as_i_i( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static int32_t fcn( int32_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_k_as_i_i( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a int32_t (*f)(int32_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_k_as_i_i( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_k_as_k_k( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static int16_t fcn( int16_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_k_as_k_k( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a int16_t (*f)(int16_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_k_as_k_k( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_t( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_t( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_t( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_t_as_b_t( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint16_t fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_t_as_b_t( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint16_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_t_as_b_t( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_t_as_t_t( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint16_t fcn( uint16_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_t_as_t_t( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint16_t (*f)(uint16_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_t_as_t_t( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_t_as_u_u( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 2 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint32_t fcn( uint32_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_t_as_u_u( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint32_t (*f)(uint32_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_t_as_u_u( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_u( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_u( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_u( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_u_as_b_u( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint32_t fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_u_as_b_u( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint32_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_u_as_b_u( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_u_as_u_u( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint32_t fcn( uint32_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_u_as_u_u( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint32_t (*f)(uint32_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_u_as_u_u( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 16 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static uint8_t fcn( uint8_t x ) {
    return x;
}

// Apply the callback:
stdlib_strided_mask_b_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a uint8_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_z_as_b_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float64/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 16 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex128_t fcn( uint8_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_z_as_b_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex128_t (*f)(uint8_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_z_as_b_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_b_z_as_z_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float64/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 1, 1, 16 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex128_t fcn( stdlib_complex128_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_b_z_as_z_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex128_t (*f)(stdlib_complex128_t) function to apply provided as a void pointer.
void stdlib_strided_mask_b_z_as_z_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_c_c( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float32/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 8, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex64_t fcn( stdlib_complex64_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_c_c( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex64_t (*f)(stdlib_complex64_t) function to apply provided as a void pointer.
void stdlib_strided_mask_c_c( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_c_c_as_z_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float64/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 8, 1, 8 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex128_t fcn( stdlib_complex128_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_c_c_as_z_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex128_t (*f)(stdlib_complex128_t) function to apply provided as a void pointer.
void stdlib_strided_mask_c_c_as_z_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_c_f_as_c_f( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float32/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 8, 1, 4 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static float fcn( stdlib_complex64_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_c_f_as_c_f( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a float (*f)(stdlib_complex64_t) function to apply provided as a void pointer.
void stdlib_strided_mask_c_f_as_c_f( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_c_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float32/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 8, 1, 16 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex64_t fcn( stdlib_complex64_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_c_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex64_t (*f)(stdlib_complex64_t) function to apply provided as a void pointer.
void stdlib_strided_mask_c_z( uint8_t *arrays[], const int64_t *shape, const int64_t *strides, void *fcn );

stdlib_strided_mask_c_z_as_c_z( *arrays[], *shape, *strides, *fcn )

Applies a unary callback to strided input array elements according to a strided mask array and assigns results to elements in a strided output array.

#include "stdlib/complex/float32/ctor.h"
#include "stdlib/complex/float64/ctor.h"
#include <stdint.h>

// Create underlying byte arrays:
uint8_t x[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t m[] = { 0, 0, 0 };
uint8_t out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

// Define a pointer to an array containing pointers to strided arrays:
uint8_t *arrays[] = { x, m, out };

// Define the strides:
int64_t strides[] = { 8, 1, 16 };

// Define the number of elements over which to iterate:
int64_t shape[] = { 3 };

// Define a callback:
static stdlib_complex128_t fcn( stdlib_complex64_t x ) {
    // ...
}

// Apply the callback:
stdlib_strided_mask_c_z_as_c_z( arrays, shape, strides, (void *)fcn );

The function accepts the following arguments:

  • arrays: [inout] uint8_t** array whose first element is a pointer to a strided input array, whose second element is a pointer to a strided mask array, and whose last element is a pointer to a strided output array.
  • shape: [in] int64_t* array whose only element is the number of elements over which to iterate.
  • strides: [in] int64_t* array containing strides (in bytes) for each strided array.
  • fcn: [in] void* a stdlib_complex128_t (*f)(stdlib_complex64_t) function to apply provided as a void pointer.
void stdlib_strided_mask