unaryBlockSize

Resolve a loop block size for multi-dimensional array tiled loops.

Usage

var unaryBlockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' );

unaryBlockSize( dtypeX, dtypeY )

Resolves a loop block size according to provided ndarray dtypes for multi-dimensional array tiled loops applying a unary function.

var bsize = unaryBlockSize( 'float64', 'float64' );
// returns <number>

Notes

  • The returned loop tiling block size is in units of elements.

Examples

var dtypes = require( '@stdlib/ndarray/dtypes' );
var cartesianSquare = require( '@stdlib/array/base/cartesian-square' );
var unaryBlockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' );

// Generate a list of ndarray dtype pairs:
var dt = cartesianSquare( dtypes() );

// Resolve the block size for each dtype pair...
var b;
var i;
for ( i = 0; i < dt.length; i++ ) {
    b = unaryBlockSize.apply( null, dt[ i ] );
    console.log( '%d, %s, %s', b, dt[i][0], dt[i][1] );
}
Did you find this page helpful?