Skip to content

Latest commit

 

History

History

is-square-matrix

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

isSquareMatrix

Test if a value is a 2-dimensional ndarray-like object having equal dimensions.

Usage

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

isSquareMatrix( value )

Tests if a value is a 2-dimensional ndarray-like object having equal dimensions.

var ndarray = require( '@stdlib/ndarray/ctor' );

var arr = ndarray( 'generic', [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
var bool = isSquareMatrix( arr );
// returns true

Examples

var ndarray = require( '@stdlib/ndarray/ctor' );
var isSquareMatrix = require( '@stdlib/assert/is-square-matrix' );

var arr = ndarray( 'generic', [ 0, 0, 0, 0 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
var out = isSquareMatrix( arr );
// returns true

out = isSquareMatrix( [ 1, 2, 3, 4 ] );
// returns false

out = isSquareMatrix( {} );
// returns false

out = isSquareMatrix( null );
// returns false

See Also