From 074dccbd3904baa65b348e58746c24c2e6210479 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sat, 8 Jun 2024 00:46:41 +0530 Subject: [PATCH 1/2] feat: add BLAS Level 2 routine for ssbmv --- .../@stdlib/blas/base/ssbmv/README.md | 313 +++++++++++ .../blas/base/ssbmv/benchmark/benchmark.js | 104 ++++ .../base/ssbmv/benchmark/benchmark.ndarray.js | 104 ++++ .../@stdlib/blas/base/ssbmv/docs/repl.txt | 165 ++++++ .../blas/base/ssbmv/docs/types/index.d.ts | 168 ++++++ .../blas/base/ssbmv/docs/types/test.ts | 500 ++++++++++++++++++ .../@stdlib/blas/base/ssbmv/examples/index.js | 45 ++ .../@stdlib/blas/base/ssbmv/lib/index.js | 92 ++++ .../@stdlib/blas/base/ssbmv/lib/main.js | 35 ++ .../@stdlib/blas/base/ssbmv/lib/ndarray.js | 243 +++++++++ .../@stdlib/blas/base/ssbmv/lib/ssbmv.js | 249 +++++++++ .../@stdlib/blas/base/ssbmv/package.json | 68 +++ .../base/ssbmv/test/fixtures/julia/REQUIRE | 2 + .../test/fixtures/julia/strides_xnyn.json | 15 + .../test/fixtures/julia/strides_xnyp.json | 15 + .../test/fixtures/julia/strides_xoyt.json | 15 + .../test/fixtures/julia/strides_xpyn.json | 15 + .../test/fixtures/julia/strides_xpyp.json | 15 + .../@stdlib/blas/base/ssbmv/test/test.js | 82 +++ .../blas/base/ssbmv/test/test.ndarray.js | 321 +++++++++++ .../blas/base/ssbmv/test/test.ssbmv.js | 321 +++++++++++ 21 files changed, 2887 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/lib/ssbmv.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/REQUIRE create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyn.json create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyp.json create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xoyt.json create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyn.json create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyp.json create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/README.md b/lib/node_modules/@stdlib/blas/base/ssbmv/README.md new file mode 100644 index 000000000000..bc380f1c3a45 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/README.md @@ -0,0 +1,313 @@ + + +# ssbmv + +> Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals. + +
+ +## Usage + +```javascript +var ssbmv = require( '@stdlib/blas/base/ssbmv' ); +``` + +#### ssbmv( ord, uplo, N, k, a, A, LDA, x, sx, b, y, sy ) + +Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var uplo = 'L'; +var order = 'row-major'; + +var N = 3; +var k = 1; +var lda = 3; + +var alpha = 1.0; +var beta = 0.0; + +var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); + +ssbmv( order, uplo, N, k, alpha, A, lda, x, 1, beta, y, 1 ); +// y => [ 3.0, 6.0, 4.0 ] +``` + +The function has the following parameters: + +- **ord**: storage layout. +- **uplo**: specifies the operation to be performed. +- **N**: specifies the order of the matrix `A`. +- **k**: number of super-diagonals. +- **a**: scalar constant. +- **A**: matrix of coefficients [`Float32Array`][mdn-float32array]. +- **lda**: stride of the first dimension of `A` (leading dimension of `A`). +- **x**: input [`Float32Array`][mdn-float32array]. +- **sx**: index increment for `x`. +- **b**: scalar constant. +- **y**: output [`Float32Array`][mdn-float32array]. +- **sy**: index increment for `y`. + +The stride parameters determine how operations are performed. For example, to +perform one of the matrix-vector operations starting from the second index of `x`, + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var uplo = 'U'; +var order = 'row-major'; + +var N = 3; +var k = 1; +var lda = 3; + +var alpha = 2.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + +ssbmv( order, uplo, N, k, alpha, A, lda, x, -1, beta, y, 1 ); +// y => [ 9.0, 36.0, 25.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +// Initial arrays... +var x0 = new Float32Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var y0 = new Float32Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var A = new Float32Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); + +// Create offset views... +var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 1st element +var y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 1st element + +ssbmv( 'row-major', 'U', 3, 1, 1.0, A, 3, x1, -1, 1.0, y1, -1 ); +// y0 => [ 1.0, 9.0, 10.0, 3.0 ] +``` + +#### ssbmv.ndarray( ord, uplo, N, k, a, A, LDA, x, sx, ox, b, y, sy, oy ) + +Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals using alternative indexing semantics. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var uplo = 'U'; +var order = 'row-major'; + +var N = 3; +var k = 1; +var lda = 3; + +var alpha = 2.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); + +ssbmv.ndarray( order, uplo, N, k, alpha, A, lda, x, -1, 2, beta, y, 1, 0 ); +// y => [ 9.0, 36.0, 25.0 ] +``` + +The function has the following additional parameters: + +- **ox**: starting index for `x`. +- **oy**: starting index for `y`. + +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 perform operation with given `x` and `y` offset values`,..., + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var uplo = 'L'; +var order = 'row-major'; + +var N = 3; +var k = 1; +var lda = 3; + +var alpha = 1.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + +ssbmv.ndarray( order, uplo, N, k, alpha, A, lda, x, -1, 2, beta, y, -1, 2 ); +// y => [ 5.0, 7.0, 4.0 ] +``` + +
+ + + +
+ +## Notes + +- `ssbmv()` corresponds to the [BLAS][blas] level 2 function [`ssbmv`][ssbmv]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ssbmv = require( '@stdlib/blas/base/ssbmv' ); + +var opts = { + 'dtype': 'float32' +}; + +var uplo = 'U'; + +var N = 3; +var k = 1; +var lda = 3; + +var alpha = 1; +var beta = 1; + +var A = discreteUniform( N*N, 0, 255, opts ); + +var x = discreteUniform( N, 0, 255, opts ); +var y = discreteUniform( N, 0, 255, opts ); + +ssbmv.ndarray( 'row-major', uplo, N, k, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); +console.log( y ); + +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/ssbmv.h" +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.js new file mode 100644 index 000000000000..2370f87fc0be --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.js @@ -0,0 +1,104 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var ssbmv = require( './../lib/ssbmv.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + var y = uniform( len, -10.0, 10.0, options ); + var A = uniform( len*len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = ssbmv( 'row-major', 'U', len, 1, 1.0, A, len, x, 1, 1.0, y, 1 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 4; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..9002151288e1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/benchmark/benchmark.ndarray.js @@ -0,0 +1,104 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var pkg = require( './../package.json' ).name; +var ssbmv = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + var y = uniform( len, -10.0, 10.0, options ); + var A = uniform( len*len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = ssbmv( 'row-major', 'U', len, 1, 1.0, A, len, x, 1, 0, 1.0, y, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 4; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/ssbmv/docs/repl.txt new file mode 100644 index 000000000000..c2c1ddb306a8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/docs/repl.txt @@ -0,0 +1,165 @@ + +{{alias}}( od, uplo, N, k, a, A, lda, x, sx, b, y, sy ) + Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` + where alpha and beta are scalars, x and y are n element vectors and A is + an n by n symmetric matrix, with k super-diagonals. + + The stride parameters determine how operations are performed. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N` is equal to `0`, the function returns `y` unchanged. + + If `a` equals `0` and b equals `1`, the function returns `y` + unchanged. + + Parameters + ---------- + od: string + Row-major (C-style) or column-major (Fortran-style) oder. + + uplo: string + Specifies whether `A` is upper or lower triangular matrix. + + N: integer + Specifies the order of the matrix `A`. + + k: integer + Specifies the number of super-diagonals. + + a: number + Scalar. + + A: Float32Array + Matrix. + + lda: integer + Leading dimension. + + x: Float32Array + Input vector `x`. + + sx: integer + Index increment for `x`. + + b: number + Scalar. + + y: Float32Array + Input/output vector `y`. + + sy: integer + Index increment for `y`. + + Returns + ------- + y: Float32Array + Output array. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > {{alias}}( 'row-major', 'U', 2, 1, 1.0, A, 2, x, 1, 1.0, y, 1 ) + [ 6.0, 7.0 ] + + // Advanced indexing: + > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > {{alias}}( 'row-major', 'U', 2, 1, 1.0, A, 2, x, -1, 1.0, y, -1 ) + [ 7.0, 6.0 ] + + // Using typed array views: + > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var y0 = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 0.0, 3.0 ] ); + > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*0 ); + > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*0 ); + > {{alias}}( 'row-major', 'U', 2, 1, 1.0, A, 2, x1, 1, 1.0, y1, 1 ) + > y0 + [ 3.0, 6.0 ] + + +{{alias}}.ndarray( od, uplo, N, k, a, A, lda, x, sx, ox, b, y, sy, oy ) + Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` + where alpha and beta are scalars, x and y are n element vectors and A is + an n by n symmetric matrix, with k super-diagonals using alternative + indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + od: string + Row-major (C-style) or column-major (Fortran-style) oder. + + uplo: string + Specifies whether `A` is upper or lower triangular matrix. + + N: integer + Specifies the order of the matrix `A`. + + k: integer + Specifies the number of super-diagonals. + + a: number + Scalar. + + A: Float32Array + Matrix. + + lda: integer + Leading dimension. + + x: Float32Array + Input vector `x`. + + sx: integer + Index increment for `x`. + + ox: integer + Starting index for `x`. + + b: number + Scalar. + + y: Float32Array + Input/output vector `y`. + + sy: integer + Index increment for `y`. + + oy: integer + Starting index for `y`. + + Returns + ------- + y: Float32Array + Output array. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var od = 'row-major'; + > {{alias}}.ndarray( od, 'U', 2, 1, 1.0, A, 2, x, 1, 0, 1.0, y, 1, 0 ) + [ 6.0, 7.0 ] + + // Advanced indexing: + > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var od = 'row-major'; + > {{alias}}.ndarray( od, 'U', 2, 1, 1.0, A, 2, x, -1, 1, 1.0, y, -1, 1 ) + [ 7.0, 6.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/index.d.ts new file mode 100644 index 000000000000..46be7abf29c8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/index.d.ts @@ -0,0 +1,168 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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. +*/ + +// TypeScript Version: 4.1 + +/** +* Interface describing `ssbmv`. +*/ +interface Routine { + /** + * Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied + * @param N - number of columns in the matrix `A` + * @param k - number of super-diagonals + * @param alpha - scalar constant + * @param A - matrix of coefficients + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - an `M` element vector + * @param strideX - `x` stride length + * @param beta - scalar constant + * @param y - an `N` element vector + * @param strideY - `y` stride length + * @returns output array `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var uplo = 'L'; + * var order = 'row-major'; + * + * var N = 3; + * var k = 1; + * var lda = 3; + * + * var alpha = 1.0; + * var beta = 0.0; + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); + * + * ssbmv( order, uplo, N, k, alpha, A, lda, x, 1, beta, y, 1 ); + * // y => [ 3.0, 6.0, 4.0 ] + */ + ( order: string, uplo: string, N: number, k: number, alpha: number, A: Float32Array, LDA: number, x: Float32Array, strideX: number, beta: number, y: Float32Array, strideY: number ): Float32Array; + + /** + * Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals using alternative indexing semantics. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied + * @param N - number of columns in the matrix `A` + * @param k - number of super-diagonals + * @param alpha - scalar constant + * @param A - matrix of coefficients + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - an `M` element vector + * @param strideX - `x` stride length + * @param offsetX - `x` index offset + * @param beta - scalar constant + * @param y - an `N` element vector + * @param strideY - `y` stride length + * @param offsetY - `y` index offset + * @returns output array `y` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var uplo = 'L'; + * var order = 'row-major'; + * + * var N = 3; + * var k = 1; + * var lda = 3; + * + * var alpha = 1.0; + * var beta = 0.0; + * + * var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); + * + * ssbmv.ndarray( order, uplo, N, k, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); + * // y => [ 3.0, 6.0, 4.0 ] + */ + ndarray( order: string, uplo: string, N: number, k: number, alpha: number, A: Float32Array, LDA: number, x: Float32Array, strideX: number, offsetX: number, beta: number, y: Float32Array, strideY: number, offsetY: number ): Float32Array; +} + +/** +* Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals. +* +* @param order - storage layout +* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied +* @param N - number of columns in the matrix `A` +* @param k - number of super-diagonals +* @param alpha - scalar constant +* @param A - matrix of coefficients +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param x - an `M` element vector +* @param strideX - `x` stride length +* @param beta - scalar constant +* @param y - an `N` element vector +* @param strideY - `y` stride length +* @returns output array `y` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var uplo = 'U'; +* var order = 'row-major'; +* +* var N = 3; +* var k = 1; +* var lda = 3; +* +* var alpha = 2.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +* var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +* +* ssbmv( order, uplo, N, k, alpha, A, lda, x, -1, beta, y, 1 ); +* // y => [ 9.0, 36.0, 25.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var uplo = 'U'; +* var order = 'row-major'; +* +* var N = 3; +* var k = 1; +* var lda = 3; +* +* var alpha = 2.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +* var y = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +* +* ssbmv.ndarray( order, uplo, N, alpha, A, lda, x, -1, 2, beta, y, 1, 0 ); +* // y => [ 9.0, 36.0, 25.0 ] +*/ +declare var ssbmv: Routine; + + +// EXPORTS // + +export = ssbmv; diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/test.ts new file mode 100644 index 000000000000..bd28d198d093 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/docs/types/test.ts @@ -0,0 +1,500 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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. +*/ + +import ssbmv = require( './index' ); + + +// TESTS // + +// The function returns a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectType Float32Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 10, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( true, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( false, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( null, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( undefined, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( [], 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( {}, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( ( x: number ): number => x, 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a character... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 10, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', true, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', false, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', null, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', undefined, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', [ '1' ], 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', {}, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', ( x: number ): number => x, 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', '10', 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', true, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', false, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', null, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', undefined, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', [], 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', {}, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', ( x: number ): number => x, 1, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, '10', 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, true, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, false, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, null, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, undefined, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, [], 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, {}, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, ( x: number ): number => x, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, '10', A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, true, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, false, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, null, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, undefined, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, [], A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, {}, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, ( x: number ): number => x, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fsixth argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, 10, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, '10', 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, true, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, false, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, null, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, undefined, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, [ '1' ], 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, {}, 10, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, ( x: number ): number => x, 10, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, '10', x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, true, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, false, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, null, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, undefined, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, [], x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, {}, x, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, ( x: number ): number => x, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a Float32Array... +{ + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, 10, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, '10', 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, true, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, false, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, null, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, undefined, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, [ '1' ], 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, {}, 1, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, ( x: number ): number => x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, '10', 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, true, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, false, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, null, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, undefined, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, [], 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, {}, 1.0, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, ( x: number ): number => x, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, '10', y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, true, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, false, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, null, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, undefined, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, [], y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, {}, y, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, ( x: number ): number => x, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eleventh argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, 10, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, '10', 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, true, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, false, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, null, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, undefined, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, [ '1' ], 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, {}, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, '10' ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, true ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, false ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, null ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, undefined ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, [] ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, {} ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv(); // $ExpectError + ssbmv( 'row-major' ); // $ExpectError + ssbmv( 'row-major', 'U' ); // $ExpectError + ssbmv( 'row-major', 'U', 10 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0 ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y ); // $ExpectError + ssbmv( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 1.0, y, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectType Float32Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 10, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( true, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( false, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( null, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( undefined, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( [], 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( {}, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( ( x: number ): number => x, 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a character... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 10, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', true, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', false, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', null, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', undefined, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', [ '1' ], 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', {}, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', ( x: number ): number => x, 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', '10', 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', true, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', false, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', null, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', undefined, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', [], 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', {}, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', ( x: number ): number => x, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, '10', 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, true, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, false, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, null, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, undefined, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, [], 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, {}, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, ( x: number ): number => x, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, '10', A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, true, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, false, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, null, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, undefined, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, [], A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, {}, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, ( x: number ): number => x, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, 10, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, '10', 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, true, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, false, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, null, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, undefined, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, [ '1' ], 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, {}, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, ( x: number ): number => x, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, '10', x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, true, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, false, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, null, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, undefined, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, [], x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, {}, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, ( x: number ): number => x, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a Float32Array... +{ + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, 10, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, '10', 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, true, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, false, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, null, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, undefined, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, [ '1' ], 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, {}, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, ( x: number ): number => x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, '10', 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, true, 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, false, 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, null, 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, undefined, 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, [], 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, {}, 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, ( x: number ): number => x, 0, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, '10', 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, true, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, false, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, null, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, undefined, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, [], 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, {}, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, ( x: number ): number => x, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eleventh argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, '10', y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, true, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, false, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, null, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, undefined, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, [], y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, {}, y, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, ( x: number ): number => x, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a Float32Array... +{ + const x = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, 10, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, '10', 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, true, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, false, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, null, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, undefined, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, [ '1' ], 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, {}, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, '10', 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, true, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, false, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, null, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, undefined, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, [], 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, {}, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, '10' ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, true ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, false ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, null ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, undefined ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, [] ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, {} ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + ssbmv.ndarray(); // $ExpectError + ssbmv.ndarray( 'row-major' ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U' ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1 ); // $ExpectError + ssbmv.ndarray( 'row-major', 'U', 10, 1, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/examples/index.js b/lib/node_modules/@stdlib/blas/base/ssbmv/examples/index.js new file mode 100644 index 000000000000..d87d771cf38e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/examples/index.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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. +*/ + +/* eslint-disable */ // FIXME + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ssbmv = require( './../lib' ); + +var opts = { + 'dtype': 'float32' +}; + +var uplo = 'U'; + +var N = 3; +var k = 1; +var lda = 3; + +var alpha = 1; +var beta = 1; + +var A = discreteUniform( N*N, 0, 255, opts ); + +var x = discreteUniform( N, 0, 255, opts ); +var y = discreteUniform( N, 0, 255, opts ); + +ssbmv.ndarray( 'row-major', uplo, N, k, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); +console.log( y ); diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/lib/index.js b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/index.js new file mode 100644 index 000000000000..53dcb8bca2fe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/index.js @@ -0,0 +1,92 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +/** +* BLAS level 2 routine to perform one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric band matrix, with k super-diagonals. +* +* @module @stdlib/blas/base/ssbmv +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var ssbmv = require( '@stdlib/blas/base/ssbmv' ); +* +* var uplo = 'L'; +* var order = 'row-major'; +* +* var N = 3; +* var k = 1; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 0.0; +* +* var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); +* +* ssbmv( order, uplo, N, k, alpha, A, lda, x, 1, beta, y, 1 ); +* // y => [ 3.0, 6.0, 4.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var ssbmv = require( '@stdlib/blas/base/ssbmv' ); +* +* var uplo = 'L'; +* var order = 'row-major'; +* +* var N = 3; +* var k = 1; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 0.0; +* +* var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); +* +* ssbmv.ndarray( order, uplo, N, k, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); +* // y => [ 3.0, 6.0, 4.0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var ssbmv; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + ssbmv = main; +} else { + ssbmv = tmp; +} + + +// EXPORTS // + +module.exports = ssbmv; + +// exports: { "ndarray": "ssbmv.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/lib/main.js b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/main.js new file mode 100644 index 000000000000..187287892c9d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var ssbmv = require( './ssbmv.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( ssbmv, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = ssbmv; diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/ndarray.js new file mode 100644 index 000000000000..ac293be58b64 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/ndarray.js @@ -0,0 +1,243 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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. +*/ + +/* eslint-disable */ // FIXME + +'use strict'; + +// MODULES // + +var max = require( '@stdlib/math/base/special/max' ); +var min = require( '@stdlib/math/base/special/min' ); + +// MAIN // + +/** +* Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric band matrix, with k super-diagonals. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied +* @param {NonNegativeInteger} N - specifies the order of matrix `A` +* @param {NonNegativeInteger} k - number of super-diagonals +* @param {number} alpha - scalar constant +* @param {Float32Array} A - matrix of coefficients +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float32Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - `x` starting index +* @param {number} beta - scalar constant +* @param {Float32Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - `y` starting index +* @returns {Float32Array} `y` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var uplo = 'L'; +* var order = 'row-major'; +* +* var N = 3; +* var k = 1; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 0.0; +* +* var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); +* +* ssbmv( order, uplo, N, k, alpha, A, lda, x, 1, beta, y, 1 ); +* // y => [ 3.0, 6.0, 4.0 ] +*/ +function ssbmv( order, uplo, N, k, alpha, A, LDA, x, strideX, offsetX, beta, y, strideY, offsetY ) { + var kplus1; + var temp1; + var temp2; + var info; + var ix; + var iy; + var jx; + var jy; + var kx; + var ky; + var i; + var j; + var l; + + info = 0; + if( uplo.toUpperCase() !== 'U' && uplo.toUpperCase() !== 'L' ) { + info = 1; + } else if( N < 0 ) { + info = 2; + } else if( k < 0 ) { + info = 3; + } else if( LDA < ( k + 1 ) ) { + info = 6; + } else if( strideX === 0 ) { + info = 8; + } else if( strideY === 0 ) { + info = 11; + } + if( info !== 0 ) { + throw new Error( 'ssbmv()::invalid input argument. On input, value of info must be 0. Value provided: ' + info + '.' ); + } + // Quick return if possible: + + if( N === 0 || ( alpha === 0.0 && beta === 1.0 ) ) { + return y; + } + // Set up the start points in `x` and `y` if the stride is negative... + + kx = offsetX; + ky = offsetY; + // Start the operations... + + if( beta !== 1.0 ) { + if( strideY === 1 ) { + if( beta === 0.0 ) { + for( i = 0; i < N; i++ ) { + y[ i ] = 0.0; + } + } else { + for( i = 0; i < N; i++ ) { + y[ i ] *= beta; + } + } + } else { + iy = ky; + if( beta === 0.0 ) { + for( i = 0; i < N; i++ ) { + y[ iy ] = 0.0; + iy += strideY; + } + } else { + for( i = 0; i < N; i++ ) { + y[ iy ] *= beta; + iy += strideY; + } + } + } + } + if( alpha === 0.0 ) { + return y; + } + if( uplo.toUpperCase() === 'U' ) { + // Form `y` when `A` is stored in upper triangle + + kplus1 = k; + if( strideX === 1 && strideY === 1 ) { + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ j ]; + temp2 = 0.0; + l = kplus1 - j; + for( i = max( 0, j - k ); i < j; i++ ) { + if( order === 'row-major' ) { + y[ i ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ i ]; + } else { + y[ i ] += temp1 * A[ ( l + i ) + j * LDA ]; + temp2 += A[ ( l + i ) + j * LDA ] * x[ i ]; + } + } + y[ j ] += temp1 * A[ kplus1 * LDA + j ] + alpha * temp2; + } + } else { + jx = kx; + jy = ky; + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ jx ]; + temp2 = 0.0; + ix = kx; + iy = ky; + l = kplus1 - j; + for( i = max( 0, j - k ); i < j; i++ ) { + if( order === 'row-major' ) { + y[ iy ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ ix ]; + } else { + y[ iy ] += temp1 * A[ ( l + i ) + j * LDA ]; + temp2 += A[ ( l + i ) + j * LDA ] * x[ ix ]; + } + ix += strideX; + iy += strideY; + } + y[ jy ] += temp1 * A[ kplus1 * LDA + j ] + alpha * temp2; + jx += strideX; + jy += strideY; + if( j >= k ) { + kx += strideX; + ky += strideY; + } + } + } + } else { + // Form `y` when `A` is stored in lower triangle + + if( strideX === 1 && strideY === 1 ) { + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ j ]; + temp2 = 0.0; + y[ j ] += temp1 * A[ j ]; + l = ( - j ); + for( i = j + 1; i < min( N, j + k + 1 ); i++ ) { + if( order === 'row-major' ) { + y[ i ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ i ]; + } else { + y[ i ] += temp1 * A[ j * LDA + ( l + i ) ]; + temp2 += A[ j * LDA + ( l + i ) ] * x[ i ]; + } + } + y[ j ] += + alpha * temp2; + } + } else { + jx = kx; + jy = ky; + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ jx ]; + temp2 = 0.0; + y[ jy ] += temp1 * A[ j ]; + l = ( - j ); + ix = jx; + iy = jy; + for( i = j + 1; i < min( N, j + k + 1 ); i++ ) { + ix += strideX; + iy += strideY; + if( order === 'row-major' ) { + y[ iy ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ ix ]; + } else { + y[ iy ] += temp1 * A[ j * LDA + ( l + i ) ]; + temp2 += A[ j * LDA + ( l + i ) ] * x[ ix ]; + } + } + y[ jy ] += alpha * temp2; + jx += strideX; + jy += strideY; + } + } + } + return y; +} + + +// EXPORTS // + +module.exports = ssbmv; diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/lib/ssbmv.js b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/ssbmv.js new file mode 100644 index 000000000000..d97a1d3bb096 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/lib/ssbmv.js @@ -0,0 +1,249 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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. +*/ + +/* eslint-disable */ // FIXME + +'use strict'; + +// MODULES // + +var max = require( '@stdlib/math/base/special/max' ); +var min = require( '@stdlib/math/base/special/min' ); + +// MAIN // + +/** +* Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric band matrix, with k super-diagonals. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied +* @param {NonNegativeInteger} N - specifies the order of matrix `A` +* @param {NonNegativeInteger} k - number of super-diagonals +* @param {number} alpha - scalar constant +* @param {Float32Array} A - matrix of coefficients +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float32Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {number} beta - scalar constant +* @param {Float32Array} y - second input array +* @param {integer} strideY - `y` stride length +* @returns {Float32Array} `y` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var uplo = 'L'; +* var order = 'row-major'; +* +* var N = 3; +* var k = 1; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 0.0; +* +* var A = new Float32Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 0.0, 0.0, 0.0 ] ); +* +* ssbmv( order, uplo, N, k, alpha, A, lda, x, 1, beta, y, 1 ); +* // y => [ 3.0, 6.0, 4.0 ] +*/ +function ssbmv( order, uplo, N, k, alpha, A, LDA, x, strideX, beta, y, strideY ) { + var kplus1; + var temp1; + var temp2; + var info; + var ix; + var iy; + var jx; + var jy; + var kx; + var ky; + var i; + var j; + var l; + + info = 0; + if( uplo.toUpperCase() !== 'U' && uplo.toUpperCase() !== 'L' ) { + info = 1; + } else if( N < 0 ) { + info = 2; + } else if( k < 0 ) { + info = 3; + } else if( LDA < ( k + 1 ) ) { + info = 6; + } else if( strideX === 0 ) { + info = 8; + } else if( strideY === 0 ) { + info = 11; + } + if( info !== 0 ) { + throw new Error( 'ssbmv()::invalid input argument. On input, value of info must be 0. Value provided: ' + info + '.' ); + } + // Quick return if possible: + + if( N === 0 || ( alpha === 0.0 && beta === 1.0 ) ) { + return y; + } + // Set up the start points in `x` and `y` if the stride is negative... + + if( strideX > 0 ) { + kx = 0; + } else { + kx = ( 1 - N ) * strideX; + } + if( strideY > 0 ) { + ky = 0; + } else { + ky = ( 1 - N ) * strideY; + } + // Start the operations... + + if( beta !== 1.0 ) { + if( strideY === 1 ) { + if( beta === 0.0 ) { + for( i = 0; i < N; i++ ) { + y[ i ] = 0.0; + } + } else { + for( i = 0; i < N; i++ ) { + y[ i ] *= beta; + } + } + } else { + iy = ky; + if( beta === 0.0 ) { + for( i = 0; i < N; i++ ) { + y[ iy ] = 0.0; + iy += strideY; + } + } else { + for( i = 0; i < N; i++ ) { + y[ iy ] *= beta; + iy += strideY; + } + } + } + } + if( alpha === 0.0 ) { + return y; + } + if( uplo.toUpperCase() === 'U' ) { + // Form `y` when `A` is stored in upper triangle + + kplus1 = k; + if( strideX === 1 && strideY === 1 ) { + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ j ]; + temp2 = 0.0; + l = kplus1 - j; + for( i = max( 0, j - k ); i < j; i++ ) { + if( order === 'row-major' ) { + y[ i ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ i ]; + } else { + y[ i ] += temp1 * A[ ( l + i ) + j * LDA ]; + temp2 += A[ ( l + i ) + j * LDA ] * x[ i ]; + } + } + y[ j ] += temp1 * A[ kplus1 * LDA + j ] + alpha * temp2; + } + } else { + jx = kx; + jy = ky; + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ jx ]; + temp2 = 0.0; + ix = kx; + iy = ky; + l = kplus1 - j; + for( i = max( 0, j - k ); i < j; i++ ) { + if( order === 'row-major' ) { + y[ iy ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ ix ]; + } else { + y[ iy ] += temp1 * A[ ( l + i ) + j * LDA ]; + temp2 += A[ ( l + i ) + j * LDA ] * x[ ix ]; + } + ix += strideX; + iy += strideY; + } + y[ jy ] += temp1 * A[ kplus1 * LDA + j ] + alpha * temp2; + jx += strideX; + jy += strideY; + if( j >= k ) { + kx += strideX; + ky += strideY; + } + } + } + } else { + // Form `y` when `A` is stored in lower triangle + + if( strideX === 1 && strideY === 1 ) { + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ j ]; + temp2 = 0.0; + y[ j ] += temp1 * A[ j ]; + l = ( - j ); + for( i = j + 1; i < min( N, j + k + 1 ); i++ ) { + if( order === 'row-major' ) { + y[ i ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ i ]; + } else { + y[ i ] += temp1 * A[ j * LDA + ( l + i ) ]; + temp2 += A[ j * LDA + ( l + i ) ] * x[ i ]; + } + } + y[ j ] += + alpha * temp2; + } + } else { + jx = kx; + jy = ky; + for( j = 0; j < N; j++ ) { + temp1 = alpha * x[ jx ]; + temp2 = 0.0; + y[ jy ] += temp1 * A[ j ]; + l = ( - j ); + ix = jx; + iy = jy; + for( i = j + 1; i < min( N, j + k + 1 ); i++ ) { + ix += strideX; + iy += strideY; + if( order === 'row-major' ) { + y[ iy ] += temp1 * A[ ( l + i ) * LDA + j ]; + temp2 += A[ ( l + i ) * LDA + j ] * x[ ix ]; + } else { + y[ iy ] += temp1 * A[ j * LDA + ( l + i ) ]; + temp2 += A[ j * LDA + ( l + i ) ] * x[ ix ]; + } + } + y[ jy ] += alpha * temp2; + jx += strideX; + jy += strideY; + } + } + } + return y; +} + + +// EXPORTS // + +module.exports = ssbmv; diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/package.json b/lib/node_modules/@stdlib/blas/base/ssbmv/package.json new file mode 100644 index 000000000000..77914f76d045 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/blas/base/ssbmv", + "version": "0.0.0", + "description": "Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric band matrix, with k super-diagonals.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "level 2", + "ssbmv", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float32", + "float", + "float32array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/REQUIRE b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/REQUIRE new file mode 100644 index 000000000000..308c3be89c85 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/REQUIRE @@ -0,0 +1,2 @@ +julia 1.5 +JSON 0.21 diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyn.json b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyn.json new file mode 100644 index 000000000000..f73c098aba6c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyn.json @@ -0,0 +1,15 @@ +{ + "uplo": "L", + "order": "row-major", + "N": 3, + "k": 1, + "alpha": 1.0, + "beta": 1.0, + "lda": 3, + "strideX": -1, + "strideY": -1, + "A": [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 1.0, 1.0 ], + "y": [ 1.0, 1.0, 1.0 ], + "y_out": [ 5.0, 7.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyp.json b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyp.json new file mode 100644 index 000000000000..ceec07849032 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xnyp.json @@ -0,0 +1,15 @@ +{ + "uplo": "U", + "order": "row-major", + "N": 3, + "k": 1, + "alpha": 2.0, + "beta": 1.0, + "lda": 3, + "strideX": -1, + "strideY": 1, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "y": [ 1.0, 2.0, 3.0 ], + "y_out": [ 9.0, 36.0, 25.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xoyt.json b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xoyt.json new file mode 100644 index 000000000000..04e0e0669697 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xoyt.json @@ -0,0 +1,15 @@ +{ + "uplo": "U", + "order": "row-major", + "N": 3, + "k": 1, + "alpha": 2.0, + "beta": 1.0, + "lda": 3, + "strideX": 1, + "strideY": 2, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "y": [ 1.0, 2.0, 3.0 ], + "y_out": [ 9.0, 2.0, 41.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyn.json b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyn.json new file mode 100644 index 000000000000..d8c10502b5f6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyn.json @@ -0,0 +1,15 @@ +{ + "uplo": "U", + "order": "row-major", + "N": 3, + "k": 1, + "alpha": 2.0, + "beta": 1.0, + "lda": 3, + "strideX": 1, + "strideY": -1, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 1.0, 1.0, 1.0 ], + "y": [ 1.0, 2.0, 3.0 ], + "y_out": [ 17.0, 20.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyp.json b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyp.json new file mode 100644 index 000000000000..457fef676c5f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/fixtures/julia/strides_xpyp.json @@ -0,0 +1,15 @@ +{ + "uplo": "L", + "order": "row-major", + "N": 3, + "k": 1, + "alpha": 1.0, + "beta": 0.0, + "lda": 3, + "strideX": 1, + "strideY": 1, + "A": [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 1.0, 1.0 ], + "y": [ 0.0, 0.0, 0.0 ], + "y_out": [ 3.0, 6.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.js b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.js new file mode 100644 index 000000000000..997024f0d260 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var ssbmv = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ssbmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof ssbmv.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var ssbmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( ssbmv, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var ssbmv; + var main; + + main = require( './../lib/ssbmv.js' ); + + ssbmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( ssbmv, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js new file mode 100644 index 000000000000..eee18812db90 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js @@ -0,0 +1,321 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +// MODULES // + +var tape = require( 'tape' ); +var Float32Array = require( '@stdlib/array/float32' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var ssbmv = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var stridexoyt = require( './fixtures/julia/strides_xoyt.json' ); +var stridexpyp = require( './fixtures/julia/strides_xpyp.json' ); +var stridexnyp = require( './fixtures/julia/strides_xnyp.json' ); +var stridexpyn = require( './fixtures/julia/strides_xpyn.json' ); +var stridexnyn = require( './fixtures/julia/strides_xnyn.json' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ssbmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 14', function test( t ) { + t.strictEqual( ssbmv.length, 14, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals, with k super-diagonals (sx=1, sy=1)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexpyp.order; + uplo = stridexpyp.uplo; + + n = stridexpyp.N; + lda = stridexpyp.lda; + k = stridexpyp.k; + + strideX = stridexpyp.strideX; + strideY = stridexpyp.strideY; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + expected = new Float32Array( stridexpyp.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=1, sy=2)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexoyt.order; + uplo = stridexoyt.uplo; + + n = stridexoyt.N; + lda = stridexoyt.lda; + k = stridexpyp.k; + + strideX = stridexoyt.strideX; + strideY = stridexoyt.strideY; + + alpha = stridexoyt.alpha; + beta = stridexoyt.beta; + + a = new Float32Array( stridexoyt.A ); + x = new Float32Array( stridexoyt.x ); + y = new Float32Array( stridexoyt.y ); + + expected = new Float32Array( stridexoyt.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=1, sy=-1)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexpyn.order; + uplo = stridexpyn.uplo; + + n = stridexpyn.N; + lda = stridexpyn.lda; + k = stridexpyn.k; + + strideX = stridexpyn.strideX; + strideY = stridexpyn.strideY; + + alpha = stridexpyn.alpha; + beta = stridexpyn.beta; + + a = new Float32Array( stridexpyn.A ); + x = new Float32Array( stridexpyn.x ); + y = new Float32Array( stridexpyn.y ); + + expected = new Float32Array( stridexpyn.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 2 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=-1, sy=1)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexnyp.order; + uplo = stridexnyp.uplo; + + n = stridexnyp.N; + lda = stridexnyp.lda; + k = stridexnyp.k; + + strideX = stridexnyp.strideX; + strideY = stridexnyp.strideY; + + alpha = stridexnyp.alpha; + beta = stridexnyp.beta; + + a = new Float32Array( stridexnyp.A ); + x = new Float32Array( stridexnyp.x ); + y = new Float32Array( stridexnyp.y ); + + expected = new Float32Array( stridexnyp.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 2, beta, y, strideY, 0 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the second input array', function test( t ) { + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexpyp.order; + uplo = stridexpyp.uplo; + + n = stridexpyp.N; + lda = stridexpyp.lda; + k = stridexpyp.k; + + strideX = stridexpyp.strideX; + strideY = stridexpyp.strideY; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexnyn.order; + uplo = stridexnyn.uplo; + + n = stridexnyn.N; + lda = stridexnyn.lda; + k = stridexnyn.k; + + strideX = stridexnyn.strideX; + strideY = stridexnyn.strideY; + + alpha = stridexnyn.alpha; + beta = stridexnyn.beta; + + a = new Float32Array( stridexnyn.A ); + x = new Float32Array( stridexnyn.x ); + y = new Float32Array( stridexnyn.y ); + + expected = new Float32Array( stridexnyn.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 2, beta, y, strideY, 2 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js new file mode 100644 index 000000000000..409f7fe890e7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js @@ -0,0 +1,321 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +// MODULES // + +var tape = require( 'tape' ); +var Float32Array = require( '@stdlib/array/float32' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var ssbmv = require( './../lib/ssbmv.js' ); + + +// FIXTURES // + +var stridexoyt = require( './fixtures/julia/strides_xoyt.json' ); +var stridexpyp = require( './fixtures/julia/strides_xpyp.json' ); +var stridexnyp = require( './fixtures/julia/strides_xnyp.json' ); +var stridexpyn = require( './fixtures/julia/strides_xpyn.json' ); +var stridexnyn = require( './fixtures/julia/strides_xnyn.json' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ssbmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( ssbmv.length, 12, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals, with k super-diagonals (sx=1, sy=1)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexpyp.order; + uplo = stridexpyp.uplo; + + n = stridexpyp.N; + lda = stridexpyp.lda; + k = stridexpyp.k; + + strideX = stridexpyp.strideX; + strideY = stridexpyp.strideY; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + expected = new Float32Array( stridexpyp.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=1, sy=2)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexoyt.order; + uplo = stridexoyt.uplo; + + n = stridexoyt.N; + lda = stridexoyt.lda; + k = stridexpyp.k; + + strideX = stridexoyt.strideX; + strideY = stridexoyt.strideY; + + alpha = stridexoyt.alpha; + beta = stridexoyt.beta; + + a = new Float32Array( stridexoyt.A ); + x = new Float32Array( stridexoyt.x ); + y = new Float32Array( stridexoyt.y ); + + expected = new Float32Array( stridexoyt.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=1, sy=-1)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexpyn.order; + uplo = stridexpyn.uplo; + + n = stridexpyn.N; + lda = stridexpyn.lda; + k = stridexpyn.k; + + strideX = stridexpyn.strideX; + strideY = stridexpyn.strideY; + + alpha = stridexpyn.alpha; + beta = stridexpyn.beta; + + a = new Float32Array( stridexpyn.A ); + x = new Float32Array( stridexpyn.x ); + y = new Float32Array( stridexpyn.y ); + + expected = new Float32Array( stridexpyn.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=-1, sy=1)', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexnyp.order; + uplo = stridexnyp.uplo; + + n = stridexnyp.N; + lda = stridexnyp.lda; + k = stridexnyp.k; + + strideX = stridexnyp.strideX; + strideY = stridexnyp.strideY; + + alpha = stridexnyp.alpha; + beta = stridexnyp.beta; + + a = new Float32Array( stridexnyp.A ); + x = new Float32Array( stridexnyp.x ); + y = new Float32Array( stridexnyp.y ); + + expected = new Float32Array( stridexnyp.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the second input array', function test( t ) { + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexpyp.order; + uplo = stridexpyp.uplo; + + n = stridexpyp.N; + lda = stridexpyp.lda; + k = stridexpyp.k; + + strideX = stridexpyp.strideX; + strideY = stridexpyp.strideY; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var strideX; + var strideY; + var alpha; + var order; + var beta; + var uplo; + var lda; + var out; + var a; + var k; + var n; + var x; + var y; + + order = stridexnyn.order; + uplo = stridexnyn.uplo; + + n = stridexnyn.N; + lda = stridexnyn.lda; + k = stridexnyn.k; + + strideX = stridexnyn.strideX; + strideY = stridexnyn.strideY; + + alpha = stridexnyn.alpha; + beta = stridexnyn.beta; + + a = new Float32Array( stridexnyn.A ); + x = new Float32Array( stridexnyn.x ); + y = new Float32Array( stridexnyn.y ); + + expected = new Float32Array( stridexnyn.y_out ); + + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); From ee7d65f1d2538acab610e78d6811b4319ae7313c Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sat, 8 Jun 2024 00:54:59 +0530 Subject: [PATCH 2/2] chore: resolve test warnings --- .../blas/base/ssbmv/test/test.ndarray.js | 72 +++++++++---------- .../blas/base/ssbmv/test/test.ssbmv.js | 68 +++++++++--------- 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js index eee18812db90..31ffb5c8c02d 100644 --- a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ndarray.js @@ -113,7 +113,7 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o expected = new Float32Array( stridexpyp.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); @@ -154,13 +154,13 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o expected = new Float32Array( stridexoyt.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); }); -tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=1, sy=-1)', function test( t ) { +tape( 'the function supports an `x` offset', function test( t ) { var expected; var strideX; var strideY; @@ -176,32 +176,32 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o var x; var y; - order = stridexpyn.order; - uplo = stridexpyn.uplo; + order = stridexnyp.order; + uplo = stridexnyp.uplo; - n = stridexpyn.N; - lda = stridexpyn.lda; - k = stridexpyn.k; + n = stridexnyp.N; + k = stridexnyp.k; + lda = stridexnyp.lda; - strideX = stridexpyn.strideX; - strideY = stridexpyn.strideY; + strideX = stridexnyp.strideX; + strideY = stridexnyp.strideY; - alpha = stridexpyn.alpha; - beta = stridexpyn.beta; + alpha = stridexnyp.alpha; + beta = stridexnyp.beta; - a = new Float32Array( stridexpyn.A ); - x = new Float32Array( stridexpyn.x ); - y = new Float32Array( stridexpyn.y ); + a = new Float32Array( stridexnyp.A ); + x = new Float32Array( stridexnyp.x ); + y = new Float32Array( stridexnyp.y ); - expected = new Float32Array( stridexpyn.y_out ); + expected = new Float32Array( stridexnyp.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 2 ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 2, beta, y, strideY, 0 ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); }); -tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=-1, sy=1)', function test( t ) { +tape( 'the function supports a `y` offset', function test( t ) { var expected; var strideX; var strideY; @@ -217,26 +217,26 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o var x; var y; - order = stridexnyp.order; - uplo = stridexnyp.uplo; + order = stridexpyn.order; + uplo = stridexpyn.uplo; - n = stridexnyp.N; - lda = stridexnyp.lda; - k = stridexnyp.k; + n = stridexpyn.N; + k = stridexpyn.k; + lda = stridexpyn.lda; - strideX = stridexnyp.strideX; - strideY = stridexnyp.strideY; + strideX = stridexpyn.strideX; + strideY = stridexpyn.strideY; - alpha = stridexnyp.alpha; - beta = stridexnyp.beta; + alpha = stridexpyn.alpha; + beta = stridexpyn.beta; - a = new Float32Array( stridexnyp.A ); - x = new Float32Array( stridexnyp.x ); - y = new Float32Array( stridexnyp.y ); + a = new Float32Array( stridexpyn.A ); + x = new Float32Array( stridexpyn.x ); + y = new Float32Array( stridexpyn.y ); - expected = new Float32Array( stridexnyp.y_out ); + expected = new Float32Array( stridexpyn.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 2, beta, y, strideY, 0 ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 2 ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); @@ -261,8 +261,8 @@ tape( 'the function returns a reference to the second input array', function tes uplo = stridexpyp.uplo; n = stridexpyp.N; - lda = stridexpyp.lda; k = stridexpyp.k; + lda = stridexpyp.lda; strideX = stridexpyp.strideX; strideY = stridexpyp.strideY; @@ -274,7 +274,7 @@ tape( 'the function returns a reference to the second input array', function tes x = new Float32Array( stridexpyp.x ); y = new Float32Array( stridexpyp.y ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 0, beta, y, strideY, 0 ); // eslint-disable-line max-len t.strictEqual( out, y, 'returns expected value' ); t.end(); }); @@ -299,8 +299,8 @@ tape( 'the function supports complex access patterns', function test( t ) { uplo = stridexnyn.uplo; n = stridexnyn.N; - lda = stridexnyn.lda; k = stridexnyn.k; + lda = stridexnyn.lda; strideX = stridexnyn.strideX; strideY = stridexnyn.strideY; @@ -314,7 +314,7 @@ tape( 'the function supports complex access patterns', function test( t ) { expected = new Float32Array( stridexnyn.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 2, beta, y, strideY, 2 ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, 2, beta, y, strideY, 2 ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js index 409f7fe890e7..ef643d3c6151 100644 --- a/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js +++ b/lib/node_modules/@stdlib/blas/base/ssbmv/test/test.ssbmv.js @@ -113,7 +113,7 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o expected = new Float32Array( stridexpyp.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); @@ -154,13 +154,13 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o expected = new Float32Array( stridexoyt.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); }); -tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=1, sy=-1)', function test( t ) { +tape( 'the function a negative `x` stride', function test( t ) { var expected; var strideX; var strideY; @@ -176,32 +176,32 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o var x; var y; - order = stridexpyn.order; - uplo = stridexpyn.uplo; + order = stridexnyp.order; + uplo = stridexnyp.uplo; - n = stridexpyn.N; - lda = stridexpyn.lda; - k = stridexpyn.k; + n = stridexnyp.N; + lda = stridexnyp.lda; + k = stridexnyp.k; - strideX = stridexpyn.strideX; - strideY = stridexpyn.strideY; + strideX = stridexnyp.strideX; + strideY = stridexnyp.strideY; - alpha = stridexpyn.alpha; - beta = stridexpyn.beta; + alpha = stridexnyp.alpha; + beta = stridexnyp.beta; - a = new Float32Array( stridexpyn.A ); - x = new Float32Array( stridexpyn.x ); - y = new Float32Array( stridexpyn.y ); + a = new Float32Array( stridexnyp.A ); + x = new Float32Array( stridexnyp.x ); + y = new Float32Array( stridexnyp.y ); - expected = new Float32Array( stridexpyn.y_out ); + expected = new Float32Array( stridexnyp.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); }); -tape( 'the function performs one of the matrix-vector operations matrix-vector operations `y = alpha*A*x + beta*y` where alpha and beta are scalars, x and y are n element vectors and A is an n by n symmetric matrix, with k super-diagonals (sx=-1, sy=1)', function test( t ) { +tape( 'the function supports a negative `y` stride', function test( t ) { var expected; var strideX; var strideY; @@ -217,26 +217,26 @@ tape( 'the function performs one of the matrix-vector operations matrix-vector o var x; var y; - order = stridexnyp.order; - uplo = stridexnyp.uplo; + order = stridexpyn.order; + uplo = stridexpyn.uplo; - n = stridexnyp.N; - lda = stridexnyp.lda; - k = stridexnyp.k; + n = stridexpyn.N; + lda = stridexpyn.lda; + k = stridexpyn.k; - strideX = stridexnyp.strideX; - strideY = stridexnyp.strideY; + strideX = stridexpyn.strideX; + strideY = stridexpyn.strideY; - alpha = stridexnyp.alpha; - beta = stridexnyp.beta; + alpha = stridexpyn.alpha; + beta = stridexpyn.beta; - a = new Float32Array( stridexnyp.A ); - x = new Float32Array( stridexnyp.x ); - y = new Float32Array( stridexnyp.y ); + a = new Float32Array( stridexpyn.A ); + x = new Float32Array( stridexpyn.x ); + y = new Float32Array( stridexpyn.y ); - expected = new Float32Array( stridexnyp.y_out ); + expected = new Float32Array( stridexpyn.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end(); @@ -274,7 +274,7 @@ tape( 'the function returns a reference to the second input array', function tes x = new Float32Array( stridexpyp.x ); y = new Float32Array( stridexpyp.y ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); // eslint-disable-line max-len t.strictEqual( out, y, 'returns expected value' ); t.end(); }); @@ -314,7 +314,7 @@ tape( 'the function supports complex access patterns', function test( t ) { expected = new Float32Array( stridexnyn.y_out ); - out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); + out = ssbmv( order, uplo, n, k, alpha, a, lda, x, strideX, beta, y, strideY ); // eslint-disable-line max-len isApprox( t, y, expected, 2.0 ); t.strictEqual( out, y, 'returns expected value' ); t.end();