Skip to content

Latest commit

 

History

History
77 lines (49 loc) · 1.16 KB

File metadata and controls

77 lines (49 loc) · 1.16 KB

isMatrix

Test if a value is a matrix.

Usage

var isMatrix = require( '@stdlib/assert/is-matrix' );

isMatrix( value )

Tests if a value is a matrix.

var matrix = require( 'dstructs-matrix' );

var mat = matrix( [ 10, 10 ] );

var bool = isMatrix( mat );
// returns true

Examples

var matrix = require( 'dstructs-matrix' );
var Int8Array = require( '@stdlib/array/int8' );
var isMatrix = require( '@stdlib/assert/is-matrix' );

var mat = matrix( [ 10, 10 ] );

console.log( isMatrix( mat ) );
// returns true

console.log( isMatrix( [] ) );
// returns false

console.log( isMatrix( {} ) );
// returns false

console.log( isMatrix({
    'data': new Int8Array( 10 ),
    'shape': [ 5, 2 ],
    'strides': [ 2, 1 ],
    'dtype': 'int8',
    'length': 10
}));
// returns false

console.log( isMatrix( null ) );
// returns false