diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/README.md b/lib/node_modules/@stdlib/blas/base/saxpy/README.md index 3ac661e3d5e..34a588a1ae9 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/README.md +++ b/lib/node_modules/@stdlib/blas/base/saxpy/README.md @@ -54,19 +54,17 @@ The function has the following parameters: - **y**: input [`Float32Array`][mdn-float32array]. - **strideY**: index increment for `y`. -The `N` and `stride` parameters determine which elements in `x` and `y` are accessed at runtime. For example, to multiply every other value in `x` by `alpha` and add the result to the first `N` elements of `y` in reverse order, +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to multiply every other value in `x` by `alpha` and add the result to the first `N` elements of `y` in reverse order, ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); var y = new Float32Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); var alpha = 5.0; -var N = floor( x.length / 2 ); -saxpy( N, alpha, x, 2, y, -1 ); +saxpy( 3, alpha, x, 2, y, -1 ); // y => [ 26.0, 16.0, 6.0, 1.0, 1.0, 1.0 ] ``` @@ -76,7 +74,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); // Initial arrays... var x0 = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); @@ -86,9 +83,7 @@ var y0 = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element var y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element -var N = floor( x0.length / 2 ); - -saxpy( N, 5.0, x1, -2, y1, 1 ); +saxpy( 3, 5.0, x1, -2, y1, 1 ); // y0 => [ 7.0, 8.0, 9.0, 40.0, 31.0, 22.0 ] ``` @@ -112,19 +107,17 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetY**: starting index for `y`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offsetX` and `offsetY` parameters support indexing semantics based on starting indices. For example, to multiply every other value in `x` by a constant `alpha` starting from the second value and add to the last `N` elements in `y` where `x[i] -> y[n]`, `x[i+2] -> y[n-1]`,..., +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the offset parameters support indexing semantics based on starting indices. For example, to multiply every other value in `x` by a constant `alpha` starting from the second value and add to the last `N` elements in `y` where `x[i] -> y[n]`, `x[i+2] -> y[n-1]`,..., ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); var y = new Float32Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); var alpha = 5.0; -var N = floor( x.length / 2 ); -saxpy.ndarray( N, alpha, x, 2, 1, y, -1, y.length-1 ); +saxpy.ndarray( 3, alpha, x, 2, 1, y, -1, y.length-1 ); // y => [ 7.0, 8.0, 9.0, 40.0, 31.0, 22.0 ] ``` @@ -150,22 +143,14 @@ saxpy.ndarray( N, alpha, x, 2, 1, y, -1, y.length-1 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float32Array = require( '@stdlib/array/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var saxpy = require( '@stdlib/blas/base/saxpy' ); -var x; -var y; -var i; - -x = new Float32Array( 10 ); -y = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); - y[ i ] = round( randu()*10.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); + +var y = filledarrayBy( x.length, 'float32', discreteUniform( 0, 10 ) ); console.log( y ); saxpy.ndarray( x.length, 5.0, x, 1, 0, y, -1, y.length-1 ); diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.js index 11069548abf..a900013d104 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.js @@ -21,14 +21,19 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var saxpy = require( './../lib/saxpy.js' ); +// VARIABLES // + +var rand = uniform( -100.0, 100.0 ); + + // FUNCTIONS // /** @@ -39,16 +44,8 @@ var saxpy = require( './../lib/saxpy.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*200.0 ) - 100.0; - y[ i ] = ( randu()*200.0 ) - 100.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.native.js index 5416dfba9c2..9c38ce37e9f 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.native.js @@ -22,10 +22,10 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var saxpy = tryRequire( resolve( __dirname, './../lib/saxpy.native.js' ) ); var opts = { 'skip': ( saxpy instanceof Error ) }; +var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -48,16 +49,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*200.0 ) - 100.0; - y[ i ] = ( randu()*200.0 ) - 100.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.js index f5335fca870..6be145a547d 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.js @@ -21,14 +21,19 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var saxpy = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -100.0, 100.0 ); + + // FUNCTIONS // /** @@ -39,16 +44,8 @@ var saxpy = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*200.0 ) - 100.0; - y[ i ] = ( randu()*200.0 ) - 100.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.native.js index 6603286b035..f264397fea0 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/benchmark.ndarray.native.js @@ -22,10 +22,10 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var saxpy = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( saxpy instanceof Error ) }; +var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -48,16 +49,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*200.0 ) - 100.0; - y[ i ] = ( randu()*200.0 ) - 100.0; - } + var x = filledarrayBy( len, 'float32', rand ); + var y = filledarrayBy( len, 'float32', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/saxpy/docs/repl.txt index 423767285f4..4ef7ce926bd 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/saxpy/docs/repl.txt @@ -2,8 +2,8 @@ {{alias}}( N, alpha, x, strideX, y, strideY ) Multiplies a vector `x` by a constant `alpha` and adds the result to `y`. - The `N` and `stride` parameters determine which elements in `x` and `y` are - accessed at runtime. + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use typed array views. @@ -25,7 +25,7 @@ Index increment for `x`. y: Float32Array - Destination array. + Output array. strideY: integer Index increment for `y`. @@ -33,7 +33,7 @@ Returns ------- y: Float32Array - Input array `y`. + Output array. Examples -------- @@ -44,11 +44,10 @@ > {{alias}}( x.length, alpha, x, 1, y, 1 ) [ 6.0, 11.0, 16.0, 21.0, 26.0 ] - // Using `N` and `stride` parameters: + // Using `N` and stride parameters: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}( N, alpha, x, 2, y, -1 ) + > {{alias}}( 3, alpha, x, 2, y, -1 ) [ 26.0, 16.0, 6.0, 1.0, 1.0, 1.0 ] // Using view offsets: @@ -56,8 +55,7 @@ > var y0 = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); - > {{alias}}( N, 5.0, x1, -2, y1, 1 ) + > {{alias}}( 3, 5.0, x1, -2, y1, 1 ) [ 40.0, 31.0, 22.0 ] > y0 [ 7.0, 8.0, 9.0, 40.0, 31.0, 22.0 ] @@ -68,8 +66,8 @@ using alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the `offsetX` and `offsetY` parameters support indexing semantics - based on starting indices. + buffer, the offset parameters support indexing semantics based on starting + indices. Parameters ---------- @@ -89,7 +87,7 @@ Starting index for `x`. y: Float32Array - Destination array. + Output array. strideY: integer Index increment for `y`. @@ -100,7 +98,7 @@ Returns ------- y: Float32Array - Input array `y`. + Output array. Examples -------- @@ -114,8 +112,7 @@ // Advanced indexing: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, alpha, x, 2, 1, y, -1, y.length-1 ) + > {{alias}}.ndarray( 3, alpha, x, 2, 1, y, -1, y.length-1 ) [ 7.0, 8.0, 9.0, 40.0, 31.0, 22.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/saxpy/docs/types/index.d.ts index 6b16916a37d..accf861178b 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/saxpy/docs/types/index.d.ts @@ -29,9 +29,9 @@ interface Routine { * @param alpha - constant * @param x - input array * @param strideX - `x` stride length - * @param y - destination array + * @param y - output array * @param strideY - `y` stride length - * @returns `y` + * @returns output array * * @example * var Float32Array = require( `@stdlib/array/float32` ); @@ -52,10 +52,10 @@ interface Routine { * @param x - input array * @param strideX - `x` stride length * @param offsetX - starting index for `x` - * @param y - destination array + * @param y - output array * @param strideY - `y` stride length * @param offsetY - starting index for `y` - * @returns `y` + * @returns output array * * @example * var Float32Array = require( `@stdlib/array/float32` ); @@ -76,9 +76,9 @@ interface Routine { * @param alpha - constant * @param x - input array * @param strideX - `x` stride length -* @param y - destination array +* @param y - output array * @param strideY - `y` stride length -* @returns `y` +* @returns output array * * @example * var Float32Array = require( `@stdlib/array/float32` ); diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/examples/index.js b/lib/node_modules/@stdlib/blas/base/saxpy/examples/index.js index c540348c00c..497d1c86082 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/examples/index.js @@ -18,22 +18,14 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float32Array = require( '@stdlib/array/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var saxpy = require( './../lib' ); -var x; -var y; -var i; - -x = new Float32Array( 10 ); -y = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); - y[ i ] = round( randu()*10.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); + +var y = filledarrayBy( x.length, 'float32', discreteUniform( 0, 10 ) ); console.log( y ); saxpy.ndarray( x.length, 5.0, x, 1, 0, y, -1, y.length-1 ); diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/include.gypi b/lib/node_modules/@stdlib/blas/base/saxpy/include.gypi index 22e6289c74d..3bfc9e282aa 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/include.gypi +++ b/lib/node_modules/@stdlib/blas/base/saxpy/include.gypi @@ -52,7 +52,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', ' + +/** +* Receives JavaScript callback invocation data. +* +* @private +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 6 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_FLOAT( env, alpha, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 4 ); + c_saxpy( N, alpha, X, strideX, Y, strideY ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/src/addon.cpp b/lib/node_modules/@stdlib/blas/base/saxpy/src/addon.cpp deleted file mode 100644 index 668b57cf4d8..00000000000 --- a/lib/node_modules/@stdlib/blas/base/saxpy/src/addon.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/base/saxpy.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_base_saxpy { - - /** - * Multiplies a vector `X` by a constant and add the result to `Y`. - * - * ## Notes - * - * - When called from JavaScript, the function expects six arguments: - * - * - `N`: number of indexed elements - * - `alpha`: scalar - * - `X`: input array - * - `strideX`: `X` stride length - * - `Y`: destination array - * - `strideY`: `Y` stride length - */ - napi_value node_saxpy( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 6; - napi_value argv[ 6 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 6 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 6 arguments." ); - return nullptr; - } - - napi_valuetype vtype0; - status = napi_typeof( env, argv[ 0 ], &vtype0 ); - assert( status == napi_ok ); - if ( vtype0 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." ); - return nullptr; - } - - napi_valuetype vtype1; - status = napi_typeof( env, argv[ 1 ], &vtype1 ); - assert( status == napi_ok ); - if ( vtype1 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a number." ); - return nullptr; - } - - bool res2; - status = napi_is_typedarray( env, argv[ 2 ], &res2 ); - assert( status == napi_ok ); - if ( res2 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype3; - status = napi_typeof( env, argv[ 3 ], &vtype3 ); - assert( status == napi_ok ); - if ( vtype3 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a number." ); - return nullptr; - } - - bool res4; - status = napi_is_typedarray( env, argv[ 4 ], &res4 ); - assert( status == napi_ok ); - if ( res4 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype5; - status = napi_typeof( env, argv[ 5 ], &vtype5 ); - assert( status == napi_ok ); - if ( vtype5 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Sixth argument must be a number." ); - return nullptr; - } - - int64_t N; - status = napi_get_value_int64( env, argv[ 0 ], &N ); - assert( status == napi_ok ); - - double alpha; - status = napi_get_value_double( env, argv[ 1 ], &alpha ); - assert( status == napi_ok ); - - int64_t strideX; - status = napi_get_value_int64( env, argv[ 3 ], &strideX ); - assert( status == napi_ok ); - - int64_t strideY; - status = napi_get_value_int64( env, argv[ 5 ], &strideY ); - assert( status == napi_ok ); - - napi_typedarray_type vtype2; - size_t xlen; - void *X; - status = napi_get_typedarray_info( env, argv[ 2 ], &vtype2, &xlen, &X, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype2 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideX) >= (int64_t)xlen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Third argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - napi_typedarray_type vtype4; - size_t ylen; - void *Y; - status = napi_get_typedarray_info( env, argv[ 4 ], &vtype4, &ylen, &Y, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype4 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideY) >= (int64_t)ylen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Fifth argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - c_saxpy( N, alpha, (float *)X, strideX, (float *)Y, strideY ); - - return nullptr; - } - - napi_value Init( napi_env env, napi_value exports ) { - napi_status status; - napi_value fcn; - status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_saxpy, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_base_saxpy diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.c b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.c index 65d36a18383..8f6d584d776 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.c +++ b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.c @@ -25,7 +25,7 @@ * @param alpha scalar * @param X input array * @param strideX X stride length -* @param Y destination array +* @param Y output array * @param strideY Y stride length */ void c_saxpy( const int N, const float alpha, const float *X, const int strideX, float *Y, const int strideY ) { diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.f b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.f index 44c4d080218..6e3a4763ef1 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.f +++ b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy.f @@ -51,7 +51,7 @@ ! @param {real} alpha - scalar ! @param {Array} sx - input array ! @param {integer} strideX - `sx` stride length -! @param {Array} sy - destination array +! @param {Array} sy - output array ! @param {integer} strideY - `sy` stride length !< subroutine saxpy( N, alpha, sx, strideX, sy, strideY ) diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_cblas.c b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_cblas.c index a8f98a356aa..15c6b13361d 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_cblas.c @@ -26,7 +26,7 @@ * @param alpha scalar * @param X input array * @param strideX X stride length -* @param Y destination array +* @param Y output array * @param strideY Y stride length */ void c_saxpy( const int N, const float alpha, const float *X, const int strideX, float *Y, const int strideY ) { diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_f.c b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_f.c index fe256e67f9d..e1c4cfbfc32 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_f.c +++ b/lib/node_modules/@stdlib/blas/base/saxpy/src/saxpy_f.c @@ -22,13 +22,11 @@ /** * Multiplies a vector `X` by a constant and adds the result to `Y`. * -* Arguments are passed by reference to a Fortran subroutine implementing `saxpy`. -* * @param N number of elements * @param alpha scalar * @param X input array * @param strideX X stride length -* @param Y destination array +* @param Y output array * @param strideY Y stride length */ void c_saxpy( const int N, const float alpha, const float *X, const int strideX, float *Y, const int strideY ) { diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.js index 069bfc6846e..a8b75bd165a 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.js @@ -52,7 +52,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', fu saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); // Short datasets: x = new Float32Array( [ 1.0, 2.0 ] ); @@ -62,7 +62,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', fu saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -81,7 +81,7 @@ tape( 'the function efficiently handles the case where `alpha` is `0`', function saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -111,7 +111,7 @@ tape( 'the function supports an `x` stride', function test( t ) { expected = new Float32Array( [ 3.0, 7.0, 11.0, 1.0, 1.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -141,7 +141,7 @@ tape( 'the function supports an `x` offset', function test( t ) { expected = new Float32Array( [ 15.0, 19.0, 23.0, 9.0, 10.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -171,7 +171,7 @@ tape( 'the function supports a `y` stride', function test( t ) { expected = new Float32Array( [ 3.0, 1.0, 5.0, 1.0, 7.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -201,11 +201,11 @@ tape( 'the function supports a `y` offset', function test( t ) { expected = new Float32Array( [ 6.0, 7.0, 11.0, 15.0, 19.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns a reference to the destination array', function test( t ) { +tape( 'the function returns a reference to the output array', function test( t ) { var out; var x; var y; @@ -219,7 +219,7 @@ tape( 'the function returns a reference to the destination array', function test t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', function test( t ) { var expected; var x; var y; @@ -230,10 +230,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); saxpy( -1, 3.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); saxpy( 0, 3.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -264,7 +264,7 @@ tape( 'the function supports negative strides', function test( t ) { expected = new Float32Array( [ 6.0, 10.0, 17.0, 24.0, 10.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -296,7 +296,7 @@ tape( 'the function supports complex access patterns', function test( t ) { expected = new Float32Array( [ 7.0, 8.0, 9.0, 28.0, 23.0, 18.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -319,8 +319,7 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over } saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); x = new Float32Array( 123 ); y = new Float32Array( x.length ); @@ -332,8 +331,7 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over } saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.native.js index 4af068e30a3..359ba023a31 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.ndarray.native.js @@ -61,7 +61,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', op saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); // Short datasets: x = new Float32Array( [ 1.0, 2.0 ] ); @@ -71,7 +71,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', op saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -90,7 +90,7 @@ tape( 'the function efficiently handles the case where `alpha` is `0`', opts, fu saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -120,7 +120,7 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { expected = new Float32Array( [ 3.0, 7.0, 11.0, 1.0, 1.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -150,7 +150,7 @@ tape( 'the function supports an `x` offset', opts, function test( t ) { expected = new Float32Array( [ 15.0, 19.0, 23.0, 9.0, 10.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -180,7 +180,7 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { expected = new Float32Array( [ 3.0, 1.0, 5.0, 1.0, 7.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -210,11 +210,11 @@ tape( 'the function supports a `y` offset', opts, function test( t ) { expected = new Float32Array( [ 6.0, 7.0, 11.0, 15.0, 19.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns a reference to the destination array', opts, function test( t ) { +tape( 'the function returns a reference to the output array', opts, function test( t ) { var out; var x; var y; @@ -228,7 +228,7 @@ tape( 'the function returns a reference to the destination array', opts, functio t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', opts, function test( t ) { var expected; var x; var y; @@ -239,10 +239,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); saxpy( -1, 3.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); saxpy( 0, 3.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -273,7 +273,7 @@ tape( 'the function supports negative strides', opts, function test( t ) { expected = new Float32Array( [ 6.0, 10.0, 17.0, 24.0, 10.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -305,7 +305,7 @@ tape( 'the function supports complex access patterns', opts, function test( t ) expected = new Float32Array( [ 7.0, 8.0, 9.0, 28.0, 23.0, 18.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -328,8 +328,7 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over } saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); x = new Float32Array( 123 ); y = new Float32Array( x.length ); @@ -341,8 +340,7 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over } saxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.js b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.js index b727363d039..c3afd5c2867 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float32Array = require( '@stdlib/array/float32' ); var saxpy = require( './../lib/saxpy.js' ); @@ -53,7 +52,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', fu saxpy( x.length, alpha, x, 1, y, 1 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); // Short datasets: x = new Float32Array( [ 1.0, 2.0 ] ); @@ -63,7 +62,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', fu saxpy( x.length, alpha, x, 1, y, 1 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -82,7 +81,7 @@ tape( 'the function efficiently handles the case where `alpha` is `0`', function saxpy( x.length, alpha, x, 1, y, 1 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -112,7 +111,7 @@ tape( 'the function supports an `x` stride', function test( t ) { expected = new Float32Array( [ 3.0, 7.0, 11.0, 1.0, 1.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -142,11 +141,11 @@ tape( 'the function supports a `y` stride', function test( t ) { expected = new Float32Array( [ 3.0, 1.0, 5.0, 1.0, 7.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns a reference to the destination array', function test( t ) { +tape( 'the function returns a reference to the output array', function test( t ) { var out; var x; var y; @@ -160,7 +159,7 @@ tape( 'the function returns a reference to the destination array', function test t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', function test( t ) { var expected; var x; var y; @@ -171,10 +170,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); saxpy( -1, 3.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); saxpy( 0, 3.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -205,7 +204,7 @@ tape( 'the function supports negative strides', function test( t ) { expected = new Float32Array( [ 9.0, 16.0, 23.0, 9.0, 10.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -237,7 +236,7 @@ tape( 'the function supports complex access patterns', function test( t ) { expected = new Float32Array( [ 22.0, 17.0, 12.0, 10.0, 11.0, 12.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -271,7 +270,7 @@ tape( 'the function supports view offsets', function test( t ) { x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); + N = 3; saxpy( N, 3.0, x1, -2, y1, 1 ); expected = new Float32Array([ @@ -283,7 +282,7 @@ tape( 'the function supports view offsets', function test( t ) { 18.0 ]); - t.deepEqual( y0, expected, 'deep equal' ); + t.deepEqual( y0, expected, 'returns expected value' ); t.end(); }); @@ -306,8 +305,7 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` } saxpy( x.length, alpha, x, 1, y, 1 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); x = new Float32Array( 123 ); y = new Float32Array( x.length ); @@ -319,8 +317,7 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` } saxpy( x.length, alpha, x, 1, y, 1 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.native.js b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.native.js index 2f7e9d8242d..c3f3b2e43fc 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.native.js +++ b/lib/node_modules/@stdlib/blas/base/saxpy/test/test.saxpy.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -62,7 +61,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', op saxpy( x.length, alpha, x, 1, y, 1 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); // Short datasets: x = new Float32Array( [ 1.0, 2.0 ] ); @@ -72,7 +71,7 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', op saxpy( x.length, alpha, x, 1, y, 1 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -91,7 +90,7 @@ tape( 'the function efficiently handles the case where `alpha` is `0`', opts, fu saxpy( x.length, alpha, x, 1, y, 1 ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -121,7 +120,7 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { expected = new Float32Array( [ 3.0, 7.0, 11.0, 1.0, 1.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -151,11 +150,11 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { expected = new Float32Array( [ 3.0, 1.0, 5.0, 1.0, 7.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns a reference to the destination array', opts, function test( t ) { +tape( 'the function returns a reference to the output array', opts, function test( t ) { var out; var x; var y; @@ -169,7 +168,7 @@ tape( 'the function returns a reference to the destination array', opts, functio t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', opts, function test( t ) { var expected; var x; var y; @@ -180,10 +179,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); saxpy( -1, 3.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); saxpy( 0, 3.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -214,7 +213,7 @@ tape( 'the function supports negative strides', opts, function test( t ) { expected = new Float32Array( [ 9.0, 16.0, 23.0, 9.0, 10.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -246,7 +245,7 @@ tape( 'the function supports complex access patterns', opts, function test( t ) expected = new Float32Array( [ 22.0, 17.0, 12.0, 10.0, 11.0, 12.0 ] ); - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -280,7 +279,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); + N = 3; saxpy( N, 3.0, x1, -2, y1, 1 ); expected = new Float32Array([ @@ -292,7 +291,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { 18.0 ]); - t.deepEqual( y0, expected, 'deep equal' ); + t.deepEqual( y0, expected, 'returns expected value' ); t.end(); }); @@ -315,8 +314,7 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` } saxpy( x.length, alpha, x, 1, y, 1 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); x = new Float32Array( 123 ); y = new Float32Array( x.length ); @@ -328,8 +326,7 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` } saxpy( x.length, alpha, x, 1, y, 1 ); - - t.deepEqual( y, expected, 'deep equal' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); });