Buffer Constructors

ndarray data buffer constructors.

Usage

var ctors = require( '@stdlib/ndarray/base/buffer-ctors' );

ctors( dtype )

Returns an ndarray data buffer constructor for a specified data type.

var ctor = ctors( 'float64' );
// returns <Function>

If provided an unknown or unsupported data type, the function returns null.

var ctor = ctors( 'float' );
// returns null

Examples

var dtypes = require( '@stdlib/ndarray/dtypes' );
var ctors = require( '@stdlib/ndarray/base/buffer-ctors' );

var DTYPES = dtypes();

var ctor;
var i;
for ( i = 0; i < DTYPES.length; i++ ) {
    ctor = ctors( DTYPES[ i ] );
    console.log( ctor );
}
Did you find this page helpful?