@stdlib/ndarray-base-tiling-block-size
v0.1.1
Published
Resolve a loop block size for multi-dimensional array tiled loops.
Readme
blockSize
Resolve a loop block size for multi-dimensional array tiled loops.
Installation
npm install @stdlib/ndarray-base-tiling-block-sizeUsage
var blockSize = require( '@stdlib/ndarray-base-tiling-block-size' );blockSize( dtypes )
Resolves a loop block size for multi-dimensional array tiled loops according to provided ndarray data types.
var bsize = blockSize( [ 'float64', 'float64', 'float64', 'float64' ] );
// returns <number>The function supports the following arguments:
- dtypes: list of input and output ndarray data types.
Notes
- The returned loop tiling block size is in units of elements.
Examples
var dtypes = require( '@stdlib/ndarray-dtypes' );
var cartesianPower = require( '@stdlib/array-base-cartesian-power' );
var promoteDataTypes = require( '@stdlib/ndarray-base-promote-dtypes' );
var blockSize = require( '@stdlib/ndarray-base-tiling-block-size' );
// Generate a list of input ndarray dtype triplets:
var dt = cartesianPower( dtypes(), 3 );
// Resolve the block size for each dtype triplet and its promoted dtype...
var t;
var b;
var i;
console.log( 'block_size, xdtype, ydtype, zdtype, wdtype' );
for ( i = 0; i < dt.length; i++ ) {
t = promoteDataTypes( dt[ i ] );
dt[ i ].push( ( t === null ) ? 'generic' : t );
b = blockSize( dt[ i ] );
console.log( '%d, %s, %s, %s, %s', b, dt[i][0], dt[i][1], dt[i][2], dt[i][3] );
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
