diff --git a/lib/node_modules/@stdlib/array/complex64/README.md b/lib/node_modules/@stdlib/array/complex64/README.md index 3c9880c0bbb..6a1c1680530 100644 --- a/lib/node_modules/@stdlib/array/complex64/README.md +++ b/lib/node_modules/@stdlib/array/complex64/README.md @@ -514,6 +514,56 @@ len = arr.length; // returns 2 ``` + + +#### Complex64Array.prototype.at( i ) + +Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer positions. + +```javascript +var realf = require( '@stdlib/complex/realf' ); +var imagf = require( '@stdlib/complex/imagf' ); + +var arr = new Complex64Array( 10 ); + +// Set the first, second, and last elements: +arr.set( [ 1.0, -1.0 ], 0 ); +arr.set( [ 2.0, -2.0 ], 1 ); +arr.set( [ 9.0, -9.0 ], 9 ); + +// Get the first element: +var z = arr.at( 0 ); +// returns + +var re = realf( z ); +// returns 1.0 + +var im = imagf( z ); +// returns -1.0 + +// Get the last element: +z = arr.at( -1 ); +// returns + +re = realf( z ); +// returns 9.0 + +im = imagf( z ); +// returns -9.0 +``` + +If provided an out-of-bounds index, the method returns `undefined`. + +```javascript +var arr = new Complex64Array( 10 ); + +var z = arr.at( 100 ); +// returns undefined + +z = arr.at( -100 ); +// returns undefined +``` + #### Complex64Array.prototype.copyWithin( target, start\[, end] ) @@ -748,91 +798,6 @@ var bool = it.next().done; // returns true ``` - - -#### Complex64Array.prototype.get( i ) - -Returns an array element located at a nonnegative integer position (index) `i`. - -```javascript -var realf = require( '@stdlib/complex/realf' ); -var imagf = require( '@stdlib/complex/imagf' ); - -var arr = new Complex64Array( 10 ); - -// Set the first element: -arr.set( [ 1.0, -1.0 ], 0 ); - -// Get the first element: -var z = arr.get( 0 ); -// returns - -var re = realf( z ); -// returns 1.0 - -var im = imagf( z ); -// returns -1.0 -``` - -If provided an out-of-bounds index, the method returns `undefined`. - -```javascript -var arr = new Complex64Array( 10 ); - -var z = arr.get( 100 ); -// returns undefined -``` - - - -#### Complex64Array.prototype.at( i ) - -Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer positions. - -```javascript -var realf = require( '@stdlib/complex/realf' ); -var imagf = require( '@stdlib/complex/imagf' ); - -var arr = new Complex64Array( 10 ); - -// Set the first, second, and last elements: -arr.set( [ 1.0, -1.0 ], 0 ); -arr.set( [ 2.0, -2.0 ], 1 ); -arr.set( [ 9.0, -9.0 ], 9 ); - -// Get the first element: -var z = arr.at( 0 ); -// returns - -var re = realf( z ); -// returns 1.0 - -var im = imagf( z ); -// returns -1.0 - -// Get the last element: -z = arr.at( -1 ); -// returns - -re = realf( z ); -// returns 9.0 - -im = imagf( z ); -// returns -9.0 -``` - -If provided an out-of-bounds index, the method returns `undefined`. - -```javascript -var arr = new Complex64Array( 10 ); - -var z = arr.at( 100 ); -// returns undefined - -z = arr.at( -100 ); -// returns undefined -``` - #### Complex64Array.prototype.every( predicate\[, thisArg] ) @@ -891,6 +856,41 @@ var count = context.count; // returns 3 ``` + + +#### Complex64Array.prototype.get( i ) + +Returns an array element located at a nonnegative integer position (index) `i`. + +```javascript +var realf = require( '@stdlib/complex/realf' ); +var imagf = require( '@stdlib/complex/imagf' ); + +var arr = new Complex64Array( 10 ); + +// Set the first element: +arr.set( [ 1.0, -1.0 ], 0 ); + +// Get the first element: +var z = arr.get( 0 ); +// returns + +var re = realf( z ); +// returns 1.0 + +var im = imagf( z ); +// returns -1.0 +``` + +If provided an out-of-bounds index, the method returns `undefined`. + +```javascript +var arr = new Complex64Array( 10 ); + +var z = arr.get( 100 ); +// returns undefined +``` + #### Complex64Array.prototype.set( z\[, i] ) diff --git a/lib/node_modules/@stdlib/array/complex64/lib/main.js b/lib/node_modules/@stdlib/array/complex64/lib/main.js index 2add59eaa02..48b61666e13 100644 --- a/lib/node_modules/@stdlib/array/complex64/lib/main.js +++ b/lib/node_modules/@stdlib/array/complex64/lib/main.js @@ -65,7 +65,7 @@ var HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport(); * @param {*} value - value to test * @returns {boolean} boolean indicating if a value is a complex typed array */ -function isComplexArray( value ) { // TODO: move to array/base/assert/is-complex-array +function isComplexArray( value ) { return ( value instanceof Complex64Array || ( @@ -737,10 +737,10 @@ setReadOnly( Complex64Array.prototype, 'BYTES_PER_ELEMENT', Complex64Array.BYTES * var z = arr.get( 3 ); * * var re = realf( z ); -* // returns 2 +* // returns 2.0 * * var im = imagf( z ); -* // returns 2 +* // returns 2.0 */ setReadOnly( Complex64Array.prototype, 'copyWithin', function copyWithin( target, start ) { if ( !isComplexArray( this ) ) {