ndarraylike2ndarray
Convert an ndarray-like object to an
ndarray
.
Usage
var ndarraylike2ndarray = require( '@stdlib/ndarray/base/ndarraylike2ndarray' );
ndarraylike2ndarray( x )
Converts an ndarray-like object to an ndarray
.
var array = require( '@stdlib/ndarray/array' );
var arr = array( [ [ 1, 2 ], [ 3, 4 ] ] );
var out = ndarraylike2ndarray( arr );
// returns <ndarray>
Examples
var array = require( '@stdlib/ndarray/array' );
var ndarraylike2ndarray = require( '@stdlib/ndarray/base/ndarraylike2ndarray' );
// Create an ndarray:
var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
// Convert to a "base" ndarray:
var out = ndarraylike2ndarray( x );
// returns <ndarray>
// Print various properties:
console.log( 'dtype: %s', out.dtype );
console.log( 'ndims: %d', out.shape.length );
console.log( 'length: %d', out.length );
console.log( 'shape: [ %s ]', out.shape.join( ', ' ) );
console.log( 'strides: [ %s ]', out.strides.join( ', ' ) );
console.log( 'offset: %d', out.offset );
console.log( 'order: %s', out.order );