Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

falses

Create an ndarray filled with false values and having a specified shape and data type.

Usage

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

falses( dtype, shape, order )

Creates an ndarray filled with false values and having a specified shape and data type.

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

var arr = falses( 'bool', [ 2, 2 ], 'row-major' );
// returns <ndarray>[ [ false, false ], [ false, false ] ]

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

The function accepts the following arguments:

  • dtype: underlying data type. Must be a boolean or "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 falses = require( '@stdlib/ndarray/base/falses' );

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

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