@stdlib/ndarray-data-buffer
v0.2.2
Published
Return the underlying data buffer of a provided ndarray.
Downloads
708
Readme
data
Return the underlying data buffer of a provided ndarray.
Installation
npm install @stdlib/ndarray-data-buffer
Usage
var data = require( '@stdlib/ndarray-data-buffer' );
data( x )
Returns the underlying data buffer of a provided ndarray.
var zeros = require( '@stdlib/ndarray-zeros' );
var x = zeros( [ 3, 2, 3 ], {
'dtype': 'float64'
});
// returns <ndarray>
var out = data( x );
// returns <Float64Array>
Examples
var zeros = require( '@stdlib/ndarray-zeros' );
var data = require( '@stdlib/ndarray-data-buffer' );
// Create a 'float64' array...
var opts = {
'dtype': 'float64'
};
var x = zeros( [ 2, 2 ], opts );
// returns <ndarray>
var buf = data( x );
// returns <Float64Array>
// Create a 'float32' array...
opts = {
'dtype': 'float32'
};
x = zeros( [ 2, 2 ], opts );
// returns <ndarray>
buf = data( x );
// returns <Float32Array>
// Create a 'complex128' array...
opts = {
'dtype': 'complex128'
};
x = zeros( [ 2, 2 ], opts );
// returns <ndarray>
buf = data( x );
// returns <Complex128Array>
// Create an 'int32' array...
opts = {
'dtype': 'int32'
};
x = zeros( [ 2, 2 ], opts );
// returns <ndarray>
buf = data( x );
// returns <Int32Array>
See Also
@stdlib/ndarray-array
: multidimensional arrays.@stdlib/ndarray-ctor
: multidimensional array constructor.@stdlib/ndarray-dtype
: return the data type of a provided ndarray.
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.