data type (default: 'float64')
typed array
var arr = typedarray();
// returns <Float64Array>
var arr = typedarray( 'float32');
// returns <Float32Array>
Creates a typed array.
typed array length
data type (default: 'float64')
typed array
var arr = typedarray( 2 );
// returns <Float64Array>[ 0.0, 0.0 ]
var arr = typedarray( 2, 'float32' );
// returns <Float32Array>[ 0.0, 0.0 ]
Creates a typed array.
typed array from which to generate another typed array
data type (default: 'float64')
typed array
var arr = typedarray( new Float64Array( 2 ) );
// returns <Float64Array>[ 0.0, 0.0 ]
var arr = typedarray( new Float64Array( 2 ), 'float32' );
// returns <Float32Array>[ 0.0, 0.0 ]
var arr1 = typedarray( [ 5, 3 ], 'int32' );
var arr2 = typedarray( arr1 );
// returns <Float64Array>[ 5.0, 3.0 ]
var arr1 = typedarray( [ 5, 3 ], 'int32' );
var arr2 = typedarray( arr1, 'uint32' );
// returns <Uint32Array>[ 5, 3 ]
Creates a typed array.
array-like object or iterable from which to generate a typed array
data type (default: 'float64')
typed array
var arr = typedarray( [ 0.5, 0.5 ] );
// returns <Float64Array>[ 0.5, 0.5 ]
var arr = typedarray( [ 5, -3 ], 'int32' );
// returns <Int32Array>[ 5, -3 ]
Creates a typed array.
underlying ArrayBuffer
data type (default: 'float64')
typed array
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 16 );
var arr = typedarray( buf );
// returns <Float64Array>[ 0.0, 0.0 ]
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 16 );
var arr = typedarray( buf, 'float32' );
// returns <Float32Array>[ 0.0, 0.0, 0.0, 0.0 ]
Creates a typed array.
underlying ArrayBuffer
integer byte offset specifying the location of the first typed array element (default: 0)
data type (default: 'float64')
typed array
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 16 );
var arr = typedarray( buf, 8 );
// returns <Float64Array>[ 0.0 ]
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 16 );
var arr = typedarray( buf, 8, 'float32' );
// returns <Float32Array>[ 0.0, 0.0 ]
Creates a typed array.
underlying ArrayBuffer
integer byte offset specifying the location of the first typed array element (default: 0)
view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer
data type (default: 'float64')
typed array
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = typedarray( buf, 8, 2 );
// returns <Float64Array>[ 0.0, 0.0 ]
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = typedarray( buf, 8, 2, 'int32' );
// returns <Int32Array>[ 0, 0 ]
Creates a typed array.