From 1e7f5ba2419ba9c7052396246bb660cbb65fe720 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 13:07:25 +0530 Subject: [PATCH 01/12] feat: add support for accessor arrays blas/base/gaxpy --- .../@stdlib/blas/base/gaxpy/docs/repl.txt | 24 +- .../blas/base/gaxpy/docs/types/index.d.ts | 6 +- .../@stdlib/blas/base/gaxpy/examples/index.js | 2 +- .../@stdlib/blas/base/gaxpy/lib/accessors.js | 103 ++++++++ .../@stdlib/blas/base/gaxpy/lib/main.js | 51 +--- .../@stdlib/blas/base/gaxpy/lib/ndarray.js | 16 ++ .../@stdlib/blas/base/gaxpy/test/test.main.js | 155 ++++++++++++ .../blas/base/gaxpy/test/test.ndarray.js | 234 ++++++++++++++++++ 8 files changed, 531 insertions(+), 60 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt index adeb7be941b5..237ef253063c 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt @@ -18,22 +18,22 @@ alpha: number Constant. - x: Array|TypedArray - Input array. + x: ArrayLikeObject + First input array. strideX: integer Index increment for `x`. - y: Array|TypedArray - Output array. + y: ArrayLikeObject + Second input array. strideY: integer Index increment for `y`. Returns ------- - y: Array|TypedArray - Output array. + y: ArrayLikeObject + Input array `y`. Examples -------- @@ -76,8 +76,8 @@ alpha: number Constant. - x: Array|TypedArray - Input array. + x: ArrayLikeObject + First input array. strideX: integer Index increment for `x`. @@ -85,8 +85,8 @@ offsetX: integer Starting index for `x`. - y: Array|TypedArray - Output array. + y: ArrayLikeObject + Second input array. strideY: integer Index increment for `y`. @@ -96,8 +96,8 @@ Returns ------- - y: Array|TypedArray - Output array. + y: ArrayLikeObject + Input array `y`. Examples -------- diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts index 24e19a343622..88e6512fdb6d 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { NumericArray } from '@stdlib/types/array'; +import { Collection } from '@stdlib/types/array'; /** * Interface describing `gaxpy`. @@ -44,7 +44,7 @@ interface Routine { * gaxpy( x.length, 5.0, x, 1, y, 1 ); * // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ - ( N: number, alpha: number, x: NumericArray, strideX: number, y: NumericArray, strideY: number ): NumericArray; + ( N: number, alpha: number, x: Collection, strideX: number, y: Collection, strideY: number ): Collection; /** * Multiplies `x` by a constant `alpha` and adds the result to `y` using alternative indexing semantics. @@ -66,7 +66,7 @@ interface Routine { * gaxpy.ndarray( x.length, 5.0, x, 1, 0, y, 1, 0 ); * // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ - ndarray( N: number, alpha: number, x: NumericArray, strideX: number, offsetX: number, y: NumericArray, strideY: number, offsetY: number ): NumericArray; + ndarray( N: number, alpha: number, x: Collection, strideX: number, offsetX: number, y: Collection, strideY: number, offsetY: number ): Collection; } /** diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js b/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js index 55cf604d196c..4bb746a52a4a 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js @@ -22,7 +22,7 @@ var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var gaxpy = require( './../lib' ); var opts = { - 'dtype': 'generic' + 'dtype': 'float64' }; var x = discreteUniform( 10, 0, 100, opts ); console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js new file mode 100644 index 000000000000..da211aedcc31 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js @@ -0,0 +1,103 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +'use strict'; + + +// MAIN // + +/** +* Multiplies a vector `x` by a constant and adds the result to `y`. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {number} alpha - scalar +* @param {Object} x - input array object +* @param {Collection} x.data - input array data +* @param {Array} x.accessors - array element accessors +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {Object} y - output array object +* @param {Collection} y.data - output array data +* @param {Array} y.accessors - array element accessors +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @returns {Object} output array object +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); +* +* function setter( data, idx, value ) { +* data.set( value, idx ); +* } +* +* function getter( data, idx ) { +* return data.get( idx ); +* } +* +* var x = { +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ), +* 'accessors': [ getter, setter ] +* }; +* +* var y = { +* 'data': new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ), +* 'accessors': [ getter, setter ] +* }; +* +* gcopy( x.data.length, 5.0, x, 1, 0, y, 1, 0 ); +* +* var view = reinterpret64( y.data, 0 ); +* // view => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] +*/ +function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { + var xbuf; + var ybuf; + var set; + var get; + var tmp; + var ix; + var iy; + var y0; + var i; + + // Cache references to array data: + xbuf = x.data; + ybuf = y.data; + + // Cache a reference to the element accessors: + get = x.accessors[ 0 ]; + set = y.accessors[ 1 ]; + + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + y0 = ybuf[ iy ]; + tmp = alpha * get( xbuf, ix ) + y0; + set( ybuf, iy, tmp ); + ix += strideX; + iy += strideY; + } + return y; +} + + +// EXPORTS // + +module.exports = gaxpy; diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js index 9e1ae33b6461..7055ea1baef9 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js @@ -18,6 +18,12 @@ 'use strict'; +// MODULES // + +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + // VARIABLES // var M = 4; @@ -45,50 +51,7 @@ var M = 4; * // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ function gaxpy( N, alpha, x, strideX, y, strideY ) { - var ix; - var iy; - var m; - var i; - if ( N <= 0 || alpha === 0.0 ) { - return y; - } - // Use unrolled loops if both strides are equal to `1`... - if ( strideX === 1 && strideY === 1 ) { - m = N % M; - - // If we have a remainder, run a clean-up loop... - if ( m > 0 ) { - for ( i = 0; i < m; i++ ) { - y[ i ] += alpha * x[ i ]; - } - } - if ( N < M ) { - return y; - } - for ( i = m; i < N; i += M ) { - y[ i ] += alpha * x[ i ]; - y[ i+1 ] += alpha * x[ i+1 ]; - y[ i+2 ] += alpha * x[ i+2 ]; - y[ i+3 ] += alpha * x[ i+3 ]; - } - return y; - } - if ( strideX < 0 ) { - ix = (1-N) * strideX; - } else { - ix = 0; - } - if ( strideY < 0 ) { - iy = (1-N) * strideY; - } else { - iy = 0; - } - for ( i = 0; i < N; i++ ) { - y[ iy ] += alpha * x[ ix ]; - ix += strideX; - iy += strideY; - } - return y; + return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); } diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js index 3b698477d6a6..b01e0e70e20a 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js @@ -18,6 +18,12 @@ 'use strict'; +// MODULES // + +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var accessors = require( './accessors.js' ); + + // VARIABLES // var M = 4; @@ -49,11 +55,21 @@ var M = 4; function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { var ix; var iy; + var ox; + var oy; var m; var i; if ( N <= 0 || alpha === 0.0 ) { return y; } + ox = arraylike2object( x ); + oy = arraylike2object( y ); + if ( ox.accessorProtocol || oy.accessorProtocol ) { + accessors( N, ox, strideX, offsetX, oy, strideY, offsetY ); + return oy.data; + } + ix = offsetX; + iy = offsetY; ix = offsetX; iy = offsetY; diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js index 0df2f972db81..103116600fd0 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js @@ -22,6 +22,9 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); var gaxpy = require( './../lib/main.js' ); @@ -67,6 +70,35 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', fu t.end(); }); +tape( 'the function multiplies `x` by a constant and adds the result to `y` (accessors)', function test( t ) { + var expected; + var alpha; + var x; + var y; + + alpha = new Complex128( 2.0, 2.0 ); + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + + expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ] ); + + gaxpy( x.length, alpha, x, 1, y, 1 ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + + // Short datasets: + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + + expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0 ] ); + + gaxpy( x.length, alpha, x, 1, y, 1 ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function efficiently handles the case where `alpha` is `0`', function test( t ) { var expected; var alpha; @@ -115,6 +147,47 @@ tape( 'the function supports an `x` stride', function test( t ) { t.end(); }); +tape( 'the function supports an `x` stride (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0, // 1 + 7.0, + 8.0, + 9.0, // 2 + 10.0 // 2 + ] ); + y = new Complex128Array( [ + 1.0, // 0 + 1.0, // 0 + 1.0, // 1 + 1.0, // 1 + 1.0, // 2 + 1.0, // 2 + 1.0, + 1.0, + 1.0, + 1.0 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, 2, y, 1 ); + + expected = new Float64Array( [ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports a `y` stride', function test( t ) { var expected; var x; @@ -145,6 +218,47 @@ tape( 'the function supports a `y` stride', function test( t ) { t.end(); }); +tape( 'the function supports a `y` stride (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0, // 1 + 5.0, // 1 + 6.0, // 2 + 7.0, // 2 + 8.0, + 9.0, + 10.0 + ] ); + y = new Complex128Array( [ + 1.0, // 0 + 1.0, // 0 + 1.0, + 1.0, + 1.0, // 1 + 1.0, // 1 + 1.0, + 1.0, + 1.0, // 2 + 1.0 // 2 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, 1, y, 2 ); + + expected = new Float64Array( [ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns a reference to the destination array', function test( t ) { var out; var x; @@ -208,6 +322,47 @@ tape( 'the function supports negative strides', function test( t ) { t.end(); }); +tape( 'the function supports negative strides (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 2 + 2.0, // 2 + 3.0, + 4.0, + 5.0, // 1 + 6.0, // 1 + 7.0, + 8.0, + 9.0, // 0 + 10.0 // 0 + ] ); + y = new Complex128Array( [ + 11.0, // 2 + 12.0, // 2 + 13.0, // 1 + 14.0, // 1 + 15.0, // 0 + 16.0, // 0 + 17.0, + 18.0, + 19.0, + 20.0 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, -2, y, -1 ); + + expected = new Float64Array( [ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports complex access patterns', function test( t ) { var expected; var x; diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js index 492343253d65..cef6bfb5e9b8 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js @@ -66,6 +66,35 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y`', fu t.end(); }); +tape( 'the function multiplies `x` by a constant and adds the result to `y` (accessors)', function test( t ) { + var expected; + var alpha; + var x; + var y; + + alpha = new Complex128( 2.0, 2.0 ); + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + + expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ] ); + + gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + + // Short datasets: + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + + expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0 ] ); + + gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function efficiently handles the case where `alpha` is `0`', function test( t ) { var expected; var alpha; @@ -114,6 +143,47 @@ tape( 'the function supports an `x` stride', function test( t ) { t.end(); }); +tape( 'the function supports an `x` stride (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0, // 1 + 7.0, + 8.0, + 9.0, // 2 + 10.0 // 2 + ] ); + y = new Complex128Array( [ + 1.0, // 0 + 1.0, // 0 + 1.0, // 1 + 1.0, // 1 + 1.0, // 2 + 1.0, // 2 + 1.0, + 1.0, + 1.0, + 1.0 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, 2, 0, y, 1, 0 ); + + expected = new Float64Array( [ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports an `x` offset', function test( t ) { var expected; var x; @@ -144,6 +214,47 @@ tape( 'the function supports an `x` offset', function test( t ) { t.end(); }); +tape( 'the function supports an `x` offset (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, // 0 + 6.0, // 0 + 7.0, // 1 + 8.0, // 1 + 9.0, // 2 + 10.0 // 2 + ] ); + y = new Complex128Array( [ + 11.0, // 0 + 12.0, // 0 + 13.0, // 1 + 14.0, // 1 + 15.0, // 2 + 16.0, // 2 + 17.0, + 18.0, + 19.0, + 20.0 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, 1, 2, y, 1, 0 ); + + expected = new Float64Array( [ 9.0, 34.0, 11.0, 44.0, 13.0, 54.0, 17.0, 18.0, 19.0, 20.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports a `y` stride', function test( t ) { var expected; var x; @@ -174,6 +285,47 @@ tape( 'the function supports a `y` stride', function test( t ) { t.end(); }); +tape( 'the function supports a `y` stride (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0, // 1 + 5.0, // 1 + 6.0, // 2 + 7.0, // 2 + 8.0, + 9.0, + 10.0 + ] ); + y = new Complex128Array( [ + 1.0, // 0 + 1.0, // 0 + 1.0, + 1.0, + 1.0, // 1 + 1.0, // 1 + 1.0, + 1.0, + 1.0, // 2 + 1.0 // 2 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, 1, 0, y, 2, 0 ); + + expected = new Float64Array( [ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports a `y` offset', function test( t ) { var expected; var x; @@ -204,6 +356,47 @@ tape( 'the function supports a `y` offset', function test( t ) { t.end(); }); +tape( 'the function supports a `y` offset (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0, // 1 + 5.0, // 2 + 6.0, // 2 + 7.0, + 8.0, + 9.0, + 10.0 + ] ); + y = new Complex128Array( [ + 11.0, + 12.0, + 13.0, + 14.0, + 15.0, // 0 + 16.0, // 0 + 17.0, // 1 + 18.0, // 1 + 19.0, // 2 + 20.0 // 2 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, 1, 0, y, 1, 2 ); + + expected = new Float64Array( [ 11.0, 12.0, 13.0, 14.0, 13.0, 22.0, 15.0, 32.0, 17.0, 42.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns a reference to the destination array', function test( t ) { var out; var x; @@ -267,6 +460,47 @@ tape( 'the function supports negative strides', function test( t ) { t.end(); }); +tape( 'the function supports negative strides (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = new Complex128Array( [ + 1.0, // 2 + 2.0, // 2 + 3.0, + 4.0, + 5.0, // 1 + 6.0, // 1 + 7.0, + 8.0, + 9.0, // 0 + 10.0 // 0 + ] ); + y = new Complex128Array( [ + 11.0, // 2 + 12.0, // 2 + 13.0, // 1 + 14.0, // 1 + 15.0, // 0 + 16.0, // 0 + 17.0, + 18.0, + 19.0, + 20.0 + ] ); + alpha = new Complex128( 2.0, 2.0 ); + N = 3; + + gaxpy( N, alpha, x, -2, x.length-1, y, -1, y.length-1 ); + + expected = new Float64Array( [ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ] ); + + t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports complex access patterns', function test( t ) { var expected; var x; From f2a05e6796cc2a8b14b709eb2a3b334f7e0dc3b2 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 13:19:56 +0530 Subject: [PATCH 02/12] update: update implementation --- .../@stdlib/blas/base/gaxpy/lib/accessors.js | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js index da211aedcc31..774cf116bfcb 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js @@ -18,7 +18,6 @@ 'use strict'; - // MAIN // /** @@ -41,6 +40,8 @@ * @example * var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); * var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); * var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); * * function setter( data, idx, value ) { @@ -52,29 +53,31 @@ * } * * var x = { -* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ), +* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ), * 'accessors': [ getter, setter ] * }; * * var y = { -* 'data': new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0 ] ), +* 'data': new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ), * 'accessors': [ getter, setter ] * }; * -* gcopy( x.data.length, 5.0, x, 1, 0, y, 1, 0 ); +* var alpha = new Complex64( 2.0, 2.0 ); +* +* gaxpy( x.data.length, alpha, x, 1, 0, y, 1, 0 ); * * var view = reinterpret64( y.data, 0 ); -* // view => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] +* // view => [ -1.0, 7.0, -1.0, 15.0, -1.0. 23.0 ] */ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { var xbuf; var ybuf; var set; var get; - var tmp; + var tmp; var ix; var iy; - var y0; + var y0; var i; // Cache references to array data: @@ -89,10 +92,10 @@ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { iy = offsetY; for ( i = 0; i < N; i++ ) { y0 = ybuf[ iy ]; - tmp = alpha * get( xbuf, ix ) + y0; - set( ybuf, iy, tmp ); - ix += strideX; - iy += strideY; + tmp = alpha * ( get( xbuf, ix ) + y0 ); + set( ybuf, iy, tmp ); + ix += strideX; + iy += strideY; } return y; } From 35dd8ece81d2b875429aff486851b4e0562ec5b0 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 13:25:53 +0530 Subject: [PATCH 03/12] update: update implementation --- lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js index 774cf116bfcb..ca342b5f181a 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js @@ -20,6 +20,8 @@ // MAIN // +/* eslint-disable stdlib/jsdoc-doctest */ + /** * Multiplies a vector `x` by a constant and adds the result to `y`. * From 4a5478a5c2b9e37fdf5a9aec6bb70c49643c5318 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 13:28:56 +0530 Subject: [PATCH 04/12] chore: minor clean-up --- lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js index 7055ea1baef9..cf497f5af94f 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js @@ -24,11 +24,6 @@ var stride2offset = require( '@stdlib/strided/base/stride2offset' ); var ndarray = require( './ndarray.js' ); -// VARIABLES // - -var M = 4; - - // MAIN // /** From 7873e6b31223024591070c76fc3f9f67a12f4fc7 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 13:39:07 +0530 Subject: [PATCH 05/12] chore: minor clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/gaxpy/test/test.main.js | 57 +++++++------ .../blas/base/gaxpy/test/test.ndarray.js | 83 ++++++++++--------- 2 files changed, 76 insertions(+), 64 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js index 103116600fd0..0babe0433504 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js @@ -77,20 +77,20 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y` (acc var y; alpha = new Complex128( 2.0, 2.0 ); - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ]); + y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]); - expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ] ); + expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ]); gaxpy( x.length, alpha, x, 1, y, 1 ); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); // Short datasets: - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0 ]); + y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0 ]); - expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0 ] ); + expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0 ]); gaxpy( x.length, alpha, x, 1, y, 1 ); @@ -149,11 +149,12 @@ tape( 'the function supports an `x` stride', function test( t ) { tape( 'the function supports an `x` stride (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 0 2.0, // 0 3.0, @@ -164,8 +165,8 @@ tape( 'the function supports an `x` stride (accessors)', function test( t ) { 8.0, 9.0, // 2 10.0 // 2 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 1.0, // 0 1.0, // 0 1.0, // 1 @@ -176,13 +177,13 @@ tape( 'the function supports an `x` stride (accessors)', function test( t ) { 1.0, 1.0, 1.0 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, 2, y, 1 ); - expected = new Float64Array( [ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ] ); + expected = new Float64Array([ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -220,11 +221,12 @@ tape( 'the function supports a `y` stride', function test( t ) { tape( 'the function supports a `y` stride (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 0 2.0, // 0 3.0, // 1 @@ -235,8 +237,8 @@ tape( 'the function supports a `y` stride (accessors)', function test( t ) { 8.0, 9.0, 10.0 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 1.0, // 0 1.0, // 0 1.0, @@ -247,13 +249,13 @@ tape( 'the function supports a `y` stride (accessors)', function test( t ) { 1.0, 1.0, // 2 1.0 // 2 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, 1, y, 2 ); - expected = new Float64Array( [ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ] ); + expected = new Float64Array([ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -324,11 +326,12 @@ tape( 'the function supports negative strides', function test( t ) { tape( 'the function supports negative strides (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 2 2.0, // 2 3.0, @@ -339,8 +342,8 @@ tape( 'the function supports negative strides (accessors)', function test( t ) { 8.0, 9.0, // 0 10.0 // 0 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 11.0, // 2 12.0, // 2 13.0, // 1 @@ -351,13 +354,13 @@ tape( 'the function supports negative strides (accessors)', function test( t ) { 18.0, 19.0, 20.0 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, -2, y, -1 ); - expected = new Float64Array( [ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ] ); + expected = new Float64Array([ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -447,9 +450,9 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` alpha = 3.0; - x = new Array( 100 ); - y = new Array( x.length ); - expected = new Array( x.length ); + x = new Float64Array( 100 ); + y = new Float64Array( x.length ); + expected = new Float64Array( x.length ); for ( i = 0; i < x.length; i++ ) { x[ i ] = i; y[ i ] = x.length - i; @@ -460,9 +463,9 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` t.deepEqual( y, expected, 'returns expected value' ); - x = new Array( 123 ); - y = new Array( x.length ); - expected = new Array( x.length ); + x = new Float64Array( 123 ); + y = new Float64Array( x.length ); + expected = new Float64Array( x.length ); for ( i = 0; i < x.length; i++ ) { x[ i ] = i*2; y[ i ] = x.length - i; diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js index cef6bfb5e9b8..4b129c5b32f4 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js @@ -21,6 +21,10 @@ // MODULES // var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); var gaxpy = require( './../lib/ndarray.js' ); @@ -73,20 +77,20 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y` (acc var y; alpha = new Complex128( 2.0, 2.0 ); - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ]); + y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]); - expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ] ); + expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ]); gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); // Short datasets: - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0 ]); + y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0 ]); - expected = new Float64Array( [ -1.0, 7.0, -1.0, 15.0 ] ); + expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0 ]); gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); @@ -145,11 +149,12 @@ tape( 'the function supports an `x` stride', function test( t ) { tape( 'the function supports an `x` stride (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 0 2.0, // 0 3.0, @@ -160,8 +165,8 @@ tape( 'the function supports an `x` stride (accessors)', function test( t ) { 8.0, 9.0, // 2 10.0 // 2 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 1.0, // 0 1.0, // 0 1.0, // 1 @@ -172,13 +177,13 @@ tape( 'the function supports an `x` stride (accessors)', function test( t ) { 1.0, 1.0, 1.0 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, 2, 0, y, 1, 0 ); - expected = new Float64Array( [ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ] ); + expected = new Float64Array([ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -216,11 +221,12 @@ tape( 'the function supports an `x` offset', function test( t ) { tape( 'the function supports an `x` offset (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, 2.0, 3.0, @@ -231,8 +237,8 @@ tape( 'the function supports an `x` offset (accessors)', function test( t ) { 8.0, // 1 9.0, // 2 10.0 // 2 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 11.0, // 0 12.0, // 0 13.0, // 1 @@ -243,13 +249,13 @@ tape( 'the function supports an `x` offset (accessors)', function test( t ) { 18.0, 19.0, 20.0 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, 1, 2, y, 1, 0 ); - expected = new Float64Array( [ 9.0, 34.0, 11.0, 44.0, 13.0, 54.0, 17.0, 18.0, 19.0, 20.0 ] ); + expected = new Float64Array([ 9.0, 34.0, 11.0, 44.0, 13.0, 54.0, 17.0, 18.0, 19.0, 20.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -287,11 +293,12 @@ tape( 'the function supports a `y` stride', function test( t ) { tape( 'the function supports a `y` stride (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 0 2.0, // 0 3.0, // 1 @@ -302,8 +309,8 @@ tape( 'the function supports a `y` stride (accessors)', function test( t ) { 8.0, 9.0, 10.0 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 1.0, // 0 1.0, // 0 1.0, @@ -314,13 +321,13 @@ tape( 'the function supports a `y` stride (accessors)', function test( t ) { 1.0, 1.0, // 2 1.0 // 2 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, 1, 0, y, 2, 0 ); - expected = new Float64Array( [ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ] ); + expected = new Float64Array([ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -358,11 +365,12 @@ tape( 'the function supports a `y` offset', function test( t ) { tape( 'the function supports a `y` offset (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 0 2.0, // 0 3.0, // 1 @@ -373,8 +381,8 @@ tape( 'the function supports a `y` offset (accessors)', function test( t ) { 8.0, 9.0, 10.0 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 11.0, 12.0, 13.0, @@ -385,13 +393,13 @@ tape( 'the function supports a `y` offset (accessors)', function test( t ) { 18.0, // 1 19.0, // 2 20.0 // 2 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, 1, 0, y, 1, 2 ); - expected = new Float64Array( [ 11.0, 12.0, 13.0, 14.0, 13.0, 22.0, 15.0, 32.0, 17.0, 42.0 ] ); + expected = new Float64Array([ 11.0, 12.0, 13.0, 14.0, 13.0, 22.0, 15.0, 32.0, 17.0, 42.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -462,11 +470,12 @@ tape( 'the function supports negative strides', function test( t ) { tape( 'the function supports negative strides (accessors)', function test( t ) { var expected; + var alpha; var x; var y; var N; - x = new Complex128Array( [ + x = new Complex128Array([ 1.0, // 2 2.0, // 2 3.0, @@ -477,8 +486,8 @@ tape( 'the function supports negative strides (accessors)', function test( t ) { 8.0, 9.0, // 0 10.0 // 0 - ] ); - y = new Complex128Array( [ + ]); + y = new Complex128Array([ 11.0, // 2 12.0, // 2 13.0, // 1 @@ -489,13 +498,13 @@ tape( 'the function supports negative strides (accessors)', function test( t ) { 18.0, 19.0, 20.0 - ] ); + ]); alpha = new Complex128( 2.0, 2.0 ); N = 3; gaxpy( N, alpha, x, -2, x.length-1, y, -1, y.length-1 ); - expected = new Float64Array( [ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ] ); + expected = new Float64Array([ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ]); t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); t.end(); @@ -542,9 +551,9 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over alpha = 3.0; - x = new Array( 100 ); - y = new Array( x.length ); - expected = new Array( x.length ); + x = new Float64Array( 100 ); + y = new Float64Array( x.length ); + expected = new Float64Array( x.length ); for ( i = 0; i < x.length; i++ ) { x[ i ] = i; y[ i ] = x.length - i; @@ -555,9 +564,9 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over t.deepEqual( y, expected, 'returns expected value' ); - x = new Array( 123 ); - y = new Array( x.length ); - expected = new Array( x.length ); + x = new Float64Array( 123 ); + y = new Float64Array( x.length ); + expected = new Float64Array( x.length ); for ( i = 0; i < x.length; i++ ) { x[ i ] = i*2; y[ i ] = x.length - i; From f66263c2dc6acfc882cf19a8835d21873b0209a7 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 14:02:12 +0530 Subject: [PATCH 06/12] chore: update implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/gaxpy/lib/accessors.js | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js index ca342b5f181a..a6ba63ecda69 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js @@ -20,8 +20,6 @@ // MAIN // -/* eslint-disable stdlib/jsdoc-doctest */ - /** * Multiplies a vector `x` by a constant and adds the result to `y`. * @@ -42,34 +40,16 @@ * @example * var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); * var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); -* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Float32Array = require( '@stdlib/array/float32' ); * var Complex64 = require( '@stdlib/complex/float32/ctor' ); * var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); * -* function setter( data, idx, value ) { -* data.set( value, idx ); -* } -* -* function getter( data, idx ) { -* return data.get( idx ); -* } -* -* var x = { -* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ), -* 'accessors': [ getter, setter ] -* }; -* -* var y = { -* 'data': new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ), -* 'accessors': [ getter, setter ] -* }; -* -* var alpha = new Complex64( 2.0, 2.0 ); +* 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 ] ); * -* gaxpy( x.data.length, alpha, x, 1, 0, y, 1, 0 ); +* var z = gaxpy( x.length, 5.0, arraylike2object( toAccessorArray( x ) ), 1, 0, arraylike2object( toAccessorArray( y ) ), 1, 0 ); * -* var view = reinterpret64( y.data, 0 ); -* // view => [ -1.0, 7.0, -1.0, 15.0, -1.0. 23.0 ] +* // y => [ 6.0, 11.0, 16.0, 21.0, 26.0. 31.0 ] */ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { var xbuf; From b07940ebdc0cf7c3322999513a1f90bb32302534 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 16:56:37 +0530 Subject: [PATCH 07/12] chore: update implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/gaxpy/test/test.main.js | 134 ++++------- .../blas/base/gaxpy/test/test.ndarray.js | 210 ++++++------------ 2 files changed, 122 insertions(+), 222 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js index 0babe0433504..4281138860a2 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js @@ -22,9 +22,7 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); var gaxpy = require( './../lib/main.js' ); @@ -76,25 +74,25 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y` (acc var x; var y; - alpha = new Complex128( 2.0, 2.0 ); - x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ]); - y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]); + alpha = 2.0; + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + y = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; - expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ]); + expected = [ 3.0, 5.0, 7.0, 9.0, 11.0 ]; - gaxpy( x.length, alpha, x, 1, y, 1 ); + gaxpy( x.length, alpha, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); // Short datasets: - x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0 ]); - y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0 ]); + x = [ 1.0, 2.0 ]; + y = [ 1.0, 1.0 ]; - expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0 ]); + expected = [ 3.0, 5.0 ]; - gaxpy( x.length, alpha, x, 1, y, 1 ); + gaxpy( x.length, alpha, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -149,43 +147,31 @@ tape( 'the function supports an `x` stride', function test( t ) { tape( 'the function supports an `x` stride (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ + x = [ 1.0, // 0 - 2.0, // 0 - 3.0, + 2.0, + 3.0, // 1 4.0, - 5.0, // 1 - 6.0, // 1 - 7.0, - 8.0, - 9.0, // 2 - 10.0 // 2 - ]); - y = new Complex128Array([ - 1.0, // 0 + 5.0 // 2 + ]; + y = [ 1.0, // 0 1.0, // 1 - 1.0, // 1 1.0, // 2 - 1.0, // 2 - 1.0, - 1.0, 1.0, 1.0 - ]); - alpha = new Complex128( 2.0, 2.0 ); + ]; N = 3; - gaxpy( N, alpha, x, 2, y, 1 ); + gaxpy( N, 2.0, toAccessorArray( x ), 2, toAccessorArray( y ), 1 ); - expected = new Float64Array([ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ]); + expected = [ 3.0, 7.0, 11.0, 1.0, 1.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -221,43 +207,31 @@ tape( 'the function supports a `y` stride', function test( t ) { tape( 'the function supports a `y` stride (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ - 1.0, // 0 - 2.0, // 0 - 3.0, // 1 - 4.0, // 1 - 5.0, // 1 - 6.0, // 2 - 7.0, // 2 - 8.0, - 9.0, - 10.0 - ]); - y = new Complex128Array([ + x = [ 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ 1.0, // 0 1.0, - 1.0, 1.0, // 1 - 1.0, // 1 - 1.0, 1.0, - 1.0, // 2 1.0 // 2 - ]); - alpha = new Complex128( 2.0, 2.0 ); + ]; N = 3; - gaxpy( N, alpha, x, 1, y, 2 ); + gaxpy( N, 2.0, toAccessorArray( x ), 1, toAccessorArray( y ), 2 ); - expected = new Float64Array([ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ]); + expected = [ 3.0, 1.0, 5.0, 1.0, 7.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -326,43 +300,31 @@ tape( 'the function supports negative strides', function test( t ) { tape( 'the function supports negative strides (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ + x = [ 1.0, // 2 - 2.0, // 2 - 3.0, + 2.0, + 3.0, // 1 4.0, - 5.0, // 1 - 6.0, // 1 - 7.0, - 8.0, - 9.0, // 0 - 10.0 // 0 - ]); - y = new Complex128Array([ - 11.0, // 2 - 12.0, // 2 - 13.0, // 1 - 14.0, // 1 - 15.0, // 0 - 16.0, // 0 - 17.0, - 18.0, - 19.0, - 20.0 - ]); - alpha = new Complex128( 2.0, 2.0 ); + 5.0 // 0 + ]; + y = [ + 6.0, // 2 + 7.0, // 1 + 8.0, // 0 + 9.0, + 10.0 + ]; N = 3; - gaxpy( N, alpha, x, -2, y, -1 ); + gaxpy( N, 3.0, toAccessorArray( x ), -2, toAccessorArray( y ), -1 ); - expected = new Float64Array([ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ]); + expected = [ 9.0, 16.0, 23.0, 9.0, 10.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js index 4b129c5b32f4..cca4f8e76bfe 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js @@ -22,9 +22,7 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var reinterpret128 = require( '@stdlib/strided/base/reinterpret-complex128' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); var gaxpy = require( './../lib/ndarray.js' ); @@ -76,25 +74,25 @@ tape( 'the function multiplies `x` by a constant and adds the result to `y` (acc var x; var y; - alpha = new Complex128( 2.0, 2.0 ); - x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ]); - y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]); + alpha = 2.0; + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + y = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; - expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0, -1.0, 39.0 ]); + expected = [ 3.0, 5.0, 7.0, 9.0, 11.0 ]; gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); // Short datasets: - x = new Complex128Array([ 1.0, 2.0, 3.0, 4.0 ]); - y = new Complex128Array([ 1.0, 1.0, 1.0, 1.0 ]); + x = [ 1.0, 2.0 ]; + y = [ 1.0, 1.0 ]; - expected = new Float64Array([ -1.0, 7.0, -1.0, 15.0 ]); + expected = [ 3.0, 5.0 ]; - gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); + gaxpy( x.length, alpha, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 0 ); - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -149,43 +147,31 @@ tape( 'the function supports an `x` stride', function test( t ) { tape( 'the function supports an `x` stride (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ + x = [ 1.0, // 0 - 2.0, // 0 - 3.0, + 2.0, + 3.0, // 1 4.0, - 5.0, // 1 - 6.0, // 1 - 7.0, - 8.0, - 9.0, // 2 - 10.0 // 2 - ]); - y = new Complex128Array([ - 1.0, // 0 + 5.0 // 2 + ]; + y = [ 1.0, // 0 1.0, // 1 - 1.0, // 1 - 1.0, // 2 1.0, // 2 1.0, - 1.0, - 1.0, 1.0 - ]); - alpha = new Complex128( 2.0, 2.0 ); + ]; N = 3; - gaxpy( N, alpha, x, 2, 0, y, 1, 0 ); + gaxpy( N, 2.0, toAccessorArray( x ), 2, 0, toAccessorArray( y ), 1, 0 ); - expected = new Float64Array([ -1.0, 7.0, -1.0, 23.0, -1.0, 39.0, 1.0, 1.0, 1.0, 1.0 ]); + expected = [ 3.0, 7.0, 11.0, 1.0, 1.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -221,43 +207,31 @@ tape( 'the function supports an `x` offset', function test( t ) { tape( 'the function supports an `x` offset (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ + x = [ 1.0, 2.0, - 3.0, - 4.0, - 5.0, // 0 + 3.0, // 0 + 4.0, // 1 + 5.0 // 2 + ]; + y = [ 6.0, // 0 7.0, // 1 - 8.0, // 1 - 9.0, // 2 - 10.0 // 2 - ]); - y = new Complex128Array([ - 11.0, // 0 - 12.0, // 0 - 13.0, // 1 - 14.0, // 1 - 15.0, // 2 - 16.0, // 2 - 17.0, - 18.0, - 19.0, - 20.0 - ]); - alpha = new Complex128( 2.0, 2.0 ); + 8.0, // 2 + 9.0, + 10.0 + ]; N = 3; - gaxpy( N, alpha, x, 1, 2, y, 1, 0 ); + gaxpy( N, 3.0, toAccessorArray( x ), 1, 2, toAccessorArray( y ), 1, 0 ); - expected = new Float64Array([ 9.0, 34.0, 11.0, 44.0, 13.0, 54.0, 17.0, 18.0, 19.0, 20.0 ]); + expected = [ 15.0, 19.0, 23.0, 9.0, 10.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -293,43 +267,31 @@ tape( 'the function supports a `y` stride', function test( t ) { tape( 'the function supports a `y` stride (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ - 1.0, // 0 - 2.0, // 0 - 3.0, // 1 - 4.0, // 1 - 5.0, // 1 - 6.0, // 2 - 7.0, // 2 - 8.0, - 9.0, - 10.0 - ]); - y = new Complex128Array([ + x = [ 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ 1.0, // 0 1.0, - 1.0, 1.0, // 1 - 1.0, // 1 - 1.0, 1.0, - 1.0, // 2 1.0 // 2 - ]); - alpha = new Complex128( 2.0, 2.0 ); + ]; N = 3; - gaxpy( N, alpha, x, 1, 0, y, 2, 0 ); + gaxpy( N, 2, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 2, 0 ); - expected = new Float64Array([ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0, -1.0, 39.0 ]); + expected = [ 3.0, 1.0, 5.0, 1.0, 7.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -365,43 +327,31 @@ tape( 'the function supports a `y` offset', function test( t ) { tape( 'the function supports a `y` offset (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ + x = [ 1.0, // 0 - 2.0, // 0 - 3.0, // 1 - 4.0, // 1 - 5.0, // 2 - 6.0, // 2 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ + 6.0, 7.0, - 8.0, - 9.0, - 10.0 - ]); - y = new Complex128Array([ - 11.0, - 12.0, - 13.0, - 14.0, - 15.0, // 0 - 16.0, // 0 - 17.0, // 1 - 18.0, // 1 - 19.0, // 2 - 20.0 // 2 - ]); - alpha = new Complex128( 2.0, 2.0 ); + 8.0, // 0 + 9.0, // 1 + 10.0 // 2 + ]; N = 3; - gaxpy( N, alpha, x, 1, 0, y, 1, 2 ); + gaxpy( N, 3.0, x, 1, 0, y, 1, 2 ); - expected = new Float64Array([ 11.0, 12.0, 13.0, 14.0, 13.0, 22.0, 15.0, 32.0, 17.0, 42.0 ]); + expected = [ 6.0, 7.0, 11.0, 15.0, 19.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -470,43 +420,31 @@ tape( 'the function supports negative strides', function test( t ) { tape( 'the function supports negative strides (accessors)', function test( t ) { var expected; - var alpha; var x; var y; var N; - x = new Complex128Array([ + x = [ 1.0, // 2 - 2.0, // 2 - 3.0, + 2.0, + 3.0, // 1 4.0, - 5.0, // 1 - 6.0, // 1 - 7.0, - 8.0, + 5.0 // 0 + ]; + y = [ + 6.0, + 7.0, // 2 + 8.0, // 1 9.0, // 0 - 10.0 // 0 - ]); - y = new Complex128Array([ - 11.0, // 2 - 12.0, // 2 - 13.0, // 1 - 14.0, // 1 - 15.0, // 0 - 16.0, // 0 - 17.0, - 18.0, - 19.0, - 20.0 - ]); - alpha = new Complex128( 2.0, 2.0 ); + 10.0 + ]; N = 3; - gaxpy( N, alpha, x, -2, x.length-1, y, -1, y.length-1 ); + gaxpy( N, 3.0, toAccessorArray( x ), -2, x.length-1, toAccessorArray( y ), -1, y.length-2 ); - expected = new Float64Array([ 9.0, 18.0, 11.0, 36.0, 13.0, 54.0, 15.0, 72.0, 17.0, 90.0 ]); + expected = [ 6.0, 10.0, 17.0, 24.0, 10.0 ]; - t.deepEqual( reinterpret128( y, 0 ), expected, 'returns expected value' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); From ad41647b8b9319e387ceb9f344c57470f503e0c1 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 7 Jun 2025 16:59:51 +0530 Subject: [PATCH 08/12] chore: remove duplicates Co-authored-by: Athan Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js index b01e0e70e20a..d979e80c0d4c 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js @@ -70,8 +70,6 @@ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { } ix = offsetX; iy = offsetY; - ix = offsetX; - iy = offsetY; // Use unrolled loops if both strides are equal to `1`... if ( strideX === 1 && strideY === 1 ) { From 9bf24ea7ee8c346c5ba65ac227dc9eb644053fa4 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 7 Jun 2025 17:08:23 +0530 Subject: [PATCH 09/12] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js index d979e80c0d4c..92f6fb07497b 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/ndarray.js @@ -65,7 +65,7 @@ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { ox = arraylike2object( x ); oy = arraylike2object( y ); if ( ox.accessorProtocol || oy.accessorProtocol ) { - accessors( N, ox, strideX, offsetX, oy, strideY, offsetY ); + accessors( N, alpha, ox, strideX, offsetX, oy, strideY, offsetY ); return oy.data; } ix = offsetX; From b4c62a15e6aa353b2b84e1c4587a46e5d1ba8451 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 7 Jun 2025 04:39:46 -0700 Subject: [PATCH 10/12] Discard changes to lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js --- lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js b/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js index 4bb746a52a4a..55cf604d196c 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/examples/index.js @@ -22,7 +22,7 @@ var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var gaxpy = require( './../lib' ); var opts = { - 'dtype': 'float64' + 'dtype': 'generic' }; var x = discreteUniform( 10, 0, 100, opts ); console.log( x ); From 3d85f320338e03d3654bb9bf8cbd5d775d6fd979 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 7 Jun 2025 17:45:02 +0530 Subject: [PATCH 11/12] chore: update implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/gaxpy/lib/accessors.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js index a6ba63ecda69..2e003fd2ff0a 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js @@ -40,26 +40,20 @@ * @example * var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); * var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); -* var Float32Array = require( '@stdlib/array/float32' ); -* var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' ); * -* 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 x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; +* var y = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; * -* var z = gaxpy( x.length, 5.0, arraylike2object( toAccessorArray( x ) ), 1, 0, arraylike2object( toAccessorArray( y ) ), 1, 0 ); -* -* // y => [ 6.0, 11.0, 16.0, 21.0, 26.0. 31.0 ] +* gaxpy( x.length, 5.0, arraylike2object( toAccessorArray( x ) ), 1, 0, arraylike2object( toAccessorArray( y ) ), 1, 0 ); +* // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { var xbuf; var ybuf; var set; var get; - var tmp; var ix; var iy; - var y0; var i; // Cache references to array data: @@ -73,9 +67,7 @@ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { ix = offsetX; iy = offsetY; for ( i = 0; i < N; i++ ) { - y0 = ybuf[ iy ]; - tmp = alpha * ( get( xbuf, ix ) + y0 ); - set( ybuf, iy, tmp ); + set( ybuf, iy, get( ybuf, iy ) + ( alpha * get( xbuf, ix ) ) ); ix += strideX; iy += strideY; } From 34f0db80d1c629ee8943f0efc118c42af5111270 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 7 Jun 2025 14:47:29 -0700 Subject: [PATCH 12/12] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/gaxpy/README.md | 9 +- .../@stdlib/blas/base/gaxpy/docs/repl.txt | 12 +-- .../blas/base/gaxpy/docs/types/index.d.ts | 11 ++- .../blas/base/gaxpy/docs/types/test.ts | 8 +- .../@stdlib/blas/base/gaxpy/lib/accessors.js | 3 +- .../@stdlib/blas/base/gaxpy/lib/main.js | 2 +- .../@stdlib/blas/base/gaxpy/test/test.main.js | 84 +++++++++++++++++- .../blas/base/gaxpy/test/test.ndarray.js | 88 ++++++++++++++++++- 8 files changed, 195 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/README.md b/lib/node_modules/@stdlib/blas/base/gaxpy/README.md index 5f70522fd423..ede380ac7470 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/README.md +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/README.md @@ -47,9 +47,9 @@ The function has the following parameters: - **N**: number of indexed elements. - **alpha**: `numeric` constant. -- **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array]. +- **x**: first input array. - **strideX**: index increment for `x`. -- **y**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array]. +- **y**: second input array. - **strideY**: index increment for `y`. 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, @@ -119,6 +119,7 @@ gaxpy.ndarray( 3, 5.0, x, 2, 1, y, -1, y.length-1 ); - If `N <= 0` or `alpha == 0`, both functions return `y` unchanged. - `gaxpy()` corresponds to the [BLAS][blas] level 1 function [`daxpy`][daxpy] with the exception that this implementation works with any array type, not just Float64Arrays. Depending on the environment, the typed versions ([`daxpy`][@stdlib/blas/base/daxpy], [`saxpy`][@stdlib/blas/base/saxpy], etc.) are likely to be significantly more performant. +- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]). @@ -174,14 +175,14 @@ console.log( y ); [daxpy]: http://www.netlib.org/lapack/explore-html/de/da4/group__double__blas__level1.html -[mdn-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array - [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray [@stdlib/blas/base/daxpy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/daxpy [@stdlib/blas/base/saxpy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/saxpy +[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor + diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt index 237ef253063c..330a5a8d813b 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/repl.txt @@ -18,13 +18,13 @@ alpha: number Constant. - x: ArrayLikeObject + x: Array|TypedArray First input array. strideX: integer Index increment for `x`. - y: ArrayLikeObject + y: Array|TypedArray Second input array. strideY: integer @@ -32,7 +32,7 @@ Returns ------- - y: ArrayLikeObject + y: Array|TypedArray Input array `y`. Examples @@ -76,7 +76,7 @@ alpha: number Constant. - x: ArrayLikeObject + x: Array|TypedArray First input array. strideX: integer @@ -85,7 +85,7 @@ offsetX: integer Starting index for `x`. - y: ArrayLikeObject + y: Array|TypedArray Second input array. strideY: integer @@ -96,7 +96,7 @@ Returns ------- - y: ArrayLikeObject + y: Array|TypedArray Input array `y`. Examples diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts index 88e6512fdb6d..22c592ef6799 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/index.d.ts @@ -20,7 +20,12 @@ /// -import { Collection } from '@stdlib/types/array'; +import { NumericArray, Collection, AccessorArrayLike } from '@stdlib/types/array'; + +/** +* Input array. +*/ +type InputArray = NumericArray | Collection | AccessorArrayLike; /** * Interface describing `gaxpy`. @@ -44,7 +49,7 @@ interface Routine { * gaxpy( x.length, 5.0, x, 1, y, 1 ); * // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ - ( N: number, alpha: number, x: Collection, strideX: number, y: Collection, strideY: number ): Collection; + ( N: number, alpha: number, x: InputArray, strideX: number, y: T, strideY: number ): T; /** * Multiplies `x` by a constant `alpha` and adds the result to `y` using alternative indexing semantics. @@ -66,7 +71,7 @@ interface Routine { * gaxpy.ndarray( x.length, 5.0, x, 1, 0, y, 1, 0 ); * // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ - ndarray( N: number, alpha: number, x: Collection, strideX: number, offsetX: number, y: Collection, strideY: number, offsetY: number ): Collection; + ndarray( N: number, alpha: number, x: InputArray, strideX: number, offsetX: number, y: T, strideY: number, offsetY: number ): T; } /** diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/test.ts index 87f013357bdb..dce7e9be0ca0 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/docs/types/test.ts @@ -21,12 +21,12 @@ import gaxpy = require( './index' ); // TESTS // -// The function returns a numeric array... +// The function returns an array... { const x = new Float64Array( 10 ); const y = new Float64Array( 10 ); - gaxpy( x.length, 5.0, x, 1, y, 1 ); // $ExpectType NumericArray + gaxpy( x.length, 5.0, x, 1, y, 1 ); // $ExpectType Float64Array } // The compiler throws an error if the function is provided a first argument which is not a number... @@ -134,12 +134,12 @@ import gaxpy = require( './index' ); gaxpy( x.length, 5.0, x, 1, y, 1, 10 ); // $ExpectError } -// Attached to main export is an `ndarray` method which returns a numeric array... +// Attached to main export is an `ndarray` method which returns an array... { const x = new Float64Array( 10 ); const y = new Float64Array( 10 ); - gaxpy.ndarray( x.length, 5.0, x, 1, 0, y, 1, 0 ); // $ExpectType NumericArray + gaxpy.ndarray( x.length, 5.0, x, 1, 0, y, 1, 0 ); // $ExpectType Float64Array } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js index 2e003fd2ff0a..3140b6f9b07a 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/accessors.js @@ -23,6 +23,7 @@ /** * Multiplies a vector `x` by a constant and adds the result to `y`. * +* @private * @param {PositiveInteger} N - number of indexed elements * @param {number} alpha - scalar * @param {Object} x - input array object @@ -60,7 +61,7 @@ function gaxpy( N, alpha, x, strideX, offsetX, y, strideY, offsetY ) { xbuf = x.data; ybuf = y.data; - // Cache a reference to the element accessors: + // Cache references to element accessors: get = x.accessors[ 0 ]; set = y.accessors[ 1 ]; diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js index cf497f5af94f..7094c3fd2809 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/lib/main.js @@ -46,7 +46,7 @@ var ndarray = require( './ndarray.js' ); * // y => [ 6.0, 11.0, 16.0, 21.0, 26.0 ] */ function gaxpy( N, alpha, x, strideX, y, strideY ) { - return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); + return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js index 4281138860a2..9e5775411fa4 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.main.js @@ -115,6 +115,24 @@ tape( 'the function efficiently handles the case where `alpha` is `0`', function t.end(); }); +tape( 'the function efficiently handles the case where `alpha` is `0` (accessors)', function test( t ) { + var expected; + var alpha; + var x; + var y; + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + y = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; + alpha = 0.0; + + expected = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; + + gaxpy( x.length, alpha, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); + + t.deepEqual( y, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports an `x` stride', function test( t ) { var expected; var x; @@ -249,6 +267,20 @@ tape( 'the function returns a reference to the destination array', function test t.end(); }); +tape( 'the function returns a reference to the destination array (accessors)', function test( t ) { + var out; + var x; + var y; + + x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + y = toAccessorArray( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + + out = gaxpy( x.length, 3.0, x, 1, y, 1 ); + + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { var expected; var x; @@ -268,6 +300,25 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu t.end(); }); +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged (accessors)', function test( t ) { + var expected; + var x; + var y; + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; + + expected = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; + + gaxpy( -1, 3.0, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); + t.deepEqual( y, expected, 'returns expected value' ); + + gaxpy( 0, 3.0, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); + t.deepEqual( y, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports negative strides', function test( t ) { var expected; var x; @@ -360,6 +411,38 @@ tape( 'the function supports complex access patterns', function test( t ) { t.end(); }); +tape( 'the function supports complex access patterns (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0, // 2 + 6.0 + ]; + y = [ + 7.0, // 2 + 8.0, // 1 + 9.0, // 0 + 10.0, + 11.0, + 12.0 + ]; + N = 3; + + gaxpy( N, 3.0, toAccessorArray( x ), 2, toAccessorArray( y ), -1 ); + + expected = [ 22.0, 17.0, 12.0, 10.0, 11.0, 12.0 ]; + + t.deepEqual( y, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports view offsets', function test( t ) { var expected; var x0; @@ -437,6 +520,5 @@ tape( 'if both strides are equal to `1`, the function efficiently multiplies `x` gaxpy( x.length, alpha, x, 1, y, 1 ); t.deepEqual( y, expected, 'returns expected value' ); - t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js index cca4f8e76bfe..420fc525878d 100644 --- a/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/gaxpy/test/test.ndarray.js @@ -16,6 +16,8 @@ * limitations under the License. */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // @@ -115,6 +117,24 @@ tape( 'the function efficiently handles the case where `alpha` is `0`', function t.end(); }); +tape( 'the function efficiently handles the case where `alpha` is `0` (accessors)', function test( t ) { + var expected; + var alpha; + var x; + var y; + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + y = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; + alpha = 0.0; + + expected = [ 1.0, 1.0, 1.0, 1.0, 1.0 ]; + + gaxpy( x.length, alpha, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 0 ); + + t.deepEqual( y, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports an `x` stride', function test( t ) { var expected; var x; @@ -347,7 +367,7 @@ tape( 'the function supports a `y` offset (accessors)', function test( t ) { ]; N = 3; - gaxpy( N, 3.0, x, 1, 0, y, 1, 2 ); + gaxpy( N, 3.0, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 2 ); expected = [ 6.0, 7.0, 11.0, 15.0, 19.0 ]; @@ -369,6 +389,20 @@ tape( 'the function returns a reference to the destination array', function test t.end(); }); +tape( 'the function returns a reference to the destination array (accessors)', function test( t ) { + var out; + var x; + var y; + + x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + y = toAccessorArray( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + + out = gaxpy( x.length, 3.0, x, 1, 0, y, 1, 0 ); + + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { var expected; var x; @@ -388,6 +422,25 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu t.end(); }); +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged (accessors)', function test( t ) { + var expected; + var x; + var y; + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; + y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; + + expected = [ 6.0, 7.0, 8.0, 9.0, 10.0 ]; + + gaxpy( -1, 3.0, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 0 ); + t.deepEqual( y, expected, 'returns expected value' ); + + gaxpy( 0, 3.0, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 0 ); + t.deepEqual( y, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports negative strides', function test( t ) { var expected; var x; @@ -480,6 +533,38 @@ tape( 'the function supports complex access patterns', function test( t ) { t.end(); }); +tape( 'the function supports complex access patterns (accessors)', function test( t ) { + var expected; + var x; + var y; + var N; + + x = [ + 1.0, + 2.0, // 0 + 3.0, + 4.0, // 1 + 5.0, + 6.0 // 2 + ]; + y = [ + 7.0, + 8.0, + 9.0, + 10.0, // 2 + 11.0, // 1 + 12.0 // 0 + ]; + N = 3; + + gaxpy( N, 3.0, toAccessorArray( x ), 2, 1, toAccessorArray( y ), -1, y.length-1 ); + + expected = [ 7.0, 8.0, 9.0, 28.0, 23.0, 18.0 ]; + + t.deepEqual( y, expected, 'returns expected value' ); + t.end(); +}); + tape( 'if both strides are equal to `1`, the function efficiently iterates over provided arrays', function test( t ) { var expected; var alpha; @@ -514,6 +599,5 @@ tape( 'if both strides are equal to `1`, the function efficiently iterates over gaxpy( x.length, alpha, x, 1, 0, y, 1, 0 ); t.deepEqual( y, expected, 'returns expected value' ); - t.end(); });