Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

nulls

Create a null-filled ndarray having a specified shape and data type.

Usage

var nulls = require( '@stdlib/ndarray/base/nulls' );

nulls( dtype, shape, order )

Creates a null-filled ndarray having a specified shape and data type.

var getDType = require( '@stdlib/ndarray/dtype' );

var arr = nulls( 'generic', [ 2, 2 ], 'row-major' );
// returns <ndarray>[ [ null, null ], [ null, null ] ]

var dt = String( getDType( arr ) );
// returns 'generic'

The function accepts the following arguments:

  • dtype: underlying data type. Must be a "generic" data type.
  • shape: array shape.
  • order: specifies whether an ndarray is 'row-major' (C-style) or 'column-major' (Fortran-style).

Examples

var ndarray2array = require( '@stdlib/ndarray/to-array' );
var nulls = require( '@stdlib/ndarray/base/nulls' );

var arr = nulls( 'generic', [ 2, 2 ], 'row-major' );
console.log( ndarray2array( arr ) );