diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/README.md b/lib/node_modules/@stdlib/blas/base/sgemv/README.md new file mode 100644 index 000000000000..9273492d19b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/README.md @@ -0,0 +1,308 @@ + + +# sgemv + +> Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`. + +
+ +## Usage + +```javascript +var sgemv = require( '@stdlib/blas/base/sgemv' ); +``` + +#### sgemv( ord, trans, M, N, alpha, A, LDA, x, sx, beta, y, sy ) + +Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var trans = 'N'; + +var M = 2; +var N = 3; +var lda = 3; + +var alpha = 1.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +var y = new Float32Array( [ 1.0, 1.0 ] ); + +sgemv( 'row-major', trans, M, N, alpha, A, lda, x, 1, beta, y, 1 ); +// y => [ 7.0, 16.0 ] +``` + +The function has the following parameters: + +- **ord**: storage layout. +- **trans**: specifies the operation to be performed. +- **M**: number of rows in the matrix `A`. +- **N**: number of columns in the matrix `A`. +- **alpha**: 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`. +- **beta**: scalar constant. +- **y**: output [`Float32Array`][mdn-float32array]. +- **sy**: index increment for `y`. + +The stride parameters determine how operations are performed. For example, to perform vector-matrix operation `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`, + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var trans = 'N'; + +var M = 2; +var N = 2; +var lda = 2; + +var alpha = 1.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +var x = new Float32Array( [ 1.0, 1.0 ] ); +var y = new Float32Array( [ 1.0, 1.0 ] ); + +sgemv( 'row-major', 'N', M, N, alpha, A, lda, x, 1, beta, y, 1 ); +// y => [ 4.0, 8.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 ] ); +var y0 = new Float32Array( [ 1.0, 1.0 ] ); +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +// Create offset views... +var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 4th element + +sgemv( 'row-major', 'N', 2, 2, 1.0, A, 2, x1, -1, 1.0, y1, -1 ); +// y0 => [ 1.0, 8.0 ] +``` + +#### sgemv.ndarray( ord, trans, M, N, alpha, A, LDA, x, sx, ox, beta, y, sy, oy ) + +Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` using alternative indexing semantics. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var trans = 'N'; + +var M = 2; +var N = 3; +var lda = 3; + +var alpha = 1.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +var y = new Float32Array( [ 1.0, 1.0 ] ); + +sgemv.ndarray( 'row-major', trans, M, N, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); +// y => [ 7.0, 16.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 trans = 'N'; + +var M = 2; +var N = 3; +var lda = 3; + +var alpha = 1.0; +var beta = 1.0; + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Float32Array( [ 1.0, 2.0, 3.0 ] ); +var y = new Float32Array( [ 7.0, 8.0, 9.0, 10.0 ] ); + +sgemv.ndarray( 'row-major', trans, M, N, alpha, A, lda, x, 1, 0, beta, y, -2, 2 ); +// y => [ 39, 8, 23, 10 ] +``` + +
+ + + +
+ +## Notes + +- `sgemv()` corresponds to the [BLAS][blas] level 2 function [`sgemv`][sgemv]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var sgemv = require( '@stdlib/blas/base/sgemv' ); + +var opts = { + 'dtype': 'float32' +}; + +var trans = 'N'; + +var M = 3; +var N = 3; +var lda = 3; + +var alpha = 1; +var beta = 1; + +var A = discreteUniform( M*N, 0, 255, opts ); + +var x = discreteUniform( N, 0, 255, opts ); +var y = discreteUniform( M, 0, 255, opts ); + +sgemv.ndarray( 'row-major', trans, M, N, alpha, A, lda, x, -1, 2, beta, y, -1, 2 ); +console.log( y ); + +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/sgemv.h" +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/sgemv/benchmark/benchmark.js new file mode 100644 index 000000000000..49305d39b85e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/benchmark/benchmark.js @@ -0,0 +1,104 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'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 sgemv = require( './../lib/sgemv.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 = sgemv( 'row-major', 'N', len, len, 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/sgemv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemv/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..5a83a2f6f143 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/benchmark/benchmark.ndarray.js @@ -0,0 +1,104 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'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 sgemv = 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 = sgemv( 'row-major', 'N', len, len, 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+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sgemv/docs/repl.txt new file mode 100644 index 000000000000..0a245130d039 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/docs/repl.txt @@ -0,0 +1,163 @@ + +{{alias}}( ord, trans, M, N, alpha, A, lda, x, sx, beta, y, sy ) + Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` + or `y = alpha*A**T*x + beta*y`. + + The stride parameters determine how operations are performed. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `M` or `N` is equal to `0`, the function returns `y` unchanged. + + If `alpha` equals `0` and beta equals `1`, the function returns `y` + unchanged. + + Parameters + ---------- + ord: string + Row-major (C-style) or column-major (Fortran-style) order. + + trans: string + Specifies whether `A` is transposed. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + alpha: number + Scalar. + + A: Float32Array + Matrix. + + lda: integer + Leading dimension. + + x: Float32Array + Input vector `x`. + + sx: integer + Index increment for `x`. + + beta: 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', 'N', 2, 2, 1.0, A, 2, x, 1, 1.0, y, 1 ) + [ 4.0, 8.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', 'N', 2, 2, 1.0, A, 2, x, -1, 1.0, y, -1 ) + [ 8.0, 4.0 ] + + // Using typed array views: + > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, 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, 3.0, 4.0, 5.0, 6.0 ] ); + > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); + > {{alias}}( 'row-major', 'N', 2, 2, 1.0, A, 2, x1, -1, 1.0, y1, -1 ) + > y0 + [ 1.0, 8.0 ] + + +{{alias}}.ndarray( ord, trans, M, N, alpha, A, lda, x, sx, ox, beta, y, sy, oy ) + Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` + or `y = alpha*A**T*x + beta*y` 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 + ---------- + ord: string + Row-major (C-style) or column-major (Fortran-style) order. + + trans: string + Specifies whether `A` is transposed. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + alpha: 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`. + + beta: 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 ord = 'row-major'; + > {{alias}}.ndarray( ord, 'N', 2, 2, 1, A, 2, x, 1, 0, 1, y, 1, 0 ) + [ 4.0, 8.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 ord = 'row-major'; + > {{alias}}.ndarray( ord, 'N', 2, 2, 1, A, 2, x, -1, 1, 1, y, -1, 1 ) + [ 8.0, 4.0 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/sgemv/docs/types/index.d.ts new file mode 100644 index 000000000000..253e650bcb58 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/docs/types/index.d.ts @@ -0,0 +1,164 @@ +/* +* @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 `sgemv`. +*/ +interface Routine { + /** + * Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`. + * + * @param order - storage layout + * @param trans - specifies the operation to be performed + * @param NonNegative M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @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 trans = 'N'; + * + * var M = 2; + * var N = 3; + * var lda = 3; + * + * var alpha = 1.0; + * var beta = 1.0; + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0 ] ); + * + * sgemv( 'row-major', trans, M, N, alpha, A, lda, x, 1, beta, y, 1 ); + * // y => [ 7.0, 16.0 ] + */ + ( order: string, trans: string, M: number, N: 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` or `y = alpha*A**T*x + beta*y` using alternative indexing semantics. + * + * @param order - storage layout + * @param trans - specifies the operation to be performed + * @param NonNegative M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @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 trans = 'N'; + * + * var M = 2; + * var N = 3; + * var lda = 3; + * + * var alpha = 1.0; + * var beta = 1.0; + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); + * var y = new Float32Array( [ 1.0, 1.0 ] ); + * + * sgemv( 'row-major', trans, M, N, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); + * // y => [ 7.0, 16.0 ] + */ + ndarray( order: string, trans: string, M: number, N: 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` or `y = alpha*A**T*x + beta*y`. +* +* @param order - storage layout +* @param trans - specifies the operation to be performed +* @param NonNegative M - number of rows in the matrix `A` +* @param N - number of columns in the matrix `A` +* @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 trans = 'N'; +* +* var M = 3; +* var N = 3; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* +* sgemv( 'row-major', 'N', 3, 3, 1.0, A, 3, x1, -1, 1.0, y1, -1 ); +* // y => [ 25.0, 16.0, 7.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var trans = 'N'; +* +* var M = 3; +* var N = 3; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* +* sgemv( 'row-major', 'N', 3, 3, 1.0, A, 3, x1, -1, 2, 1.0, y1, -1, 2 ); +* // y => [ 25.0, 16.0, 7.0 ] +*/ +declare var sgemv: Routine; + + +// EXPORTS // + +export = sgemv; diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/sgemv/docs/types/test.ts new file mode 100644 index 000000000000..773400128831 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/docs/types/test.ts @@ -0,0 +1,502 @@ +/* +* @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 sgemv = require( './index' ); + + +// TESTS // + +// The function returns a Float32Array... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv( 10, "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( true, "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( false, "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( null, "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( undefined, "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( [], "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( {}, "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( ( x: number ): number => x, "N", 10, 10, 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 ); + + sgemv( "row-major", 10, 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", true, 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", false, 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", null, 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", undefined, 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", [ '1' ], 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", {}, 10, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", ( x: number ): number => x, 10, 10, 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 ); + + sgemv( "row-major", "N", '10', 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", true, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", false, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", null, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", undefined, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", [], 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", {}, 10, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", ( x: number ): number => x, 10, 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 ); + + sgemv( "row-major", "N", 10, '10', 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, true, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, false, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, null, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, undefined, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, [], 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, {}, 1.0, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 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 ); + + sgemv( "row-major", "N", 10, 10, '10', A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, true, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, false, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, null, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, undefined, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, [], A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, {}, A, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, ( x: number ): number => x, A, 10, x, 1, 1.0, y, 1 ); // $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 ); + const A = new Float32Array( 20 ); + + sgemv( "row-major", "N", 10, 10, 1.0, 10, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, '10', 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, true, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, false, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, null, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, undefined, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, [ '1' ], 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, {}, 10, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv( "row-major", "N", 10, 10, 1.0, A, '10', x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, true, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, false, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, null, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, undefined, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, [], x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, {}, x, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, 10, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, '10', 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, true, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, false, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, null, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, undefined, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, [ '1' ], 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, {}, 1, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, '10', 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, true, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, false, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, null, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, undefined, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, [], 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, {}, 1.0, y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, '10' y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, true y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, false y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, null y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, undefined y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, [] y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, {} y, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, 10, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, '10', 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, true, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, false, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, null, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, undefined, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, [ '1' ], 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, {}, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 twelvfth argument which is not a number... +{ + const x = new Float32Array( 10 ); + const y = new Float32Array( 10 ); + const A = new Float32Array( 20 ); + + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, '10' ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, true ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, false ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, null ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, undefined ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, [] ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y, {} ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv(); // $ExpectError + sgemv( "row-major" ); // $ExpectError + sgemv( "row-major", "N" ); // $ExpectError + sgemv( "row-major", "N", 10 ); // $ExpectError + sgemv( "row-major", "N", 10, 10 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0 ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 1.0, y ); // $ExpectError + sgemv( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( 10, "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( true, "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( false, "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( null, "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( undefined, "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( [], "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( {}, "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( ( x: number ): number => x, "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", 10, 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", true, 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", false, 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", null, 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", undefined, 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", [ '1' ], 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", {}, 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", ( x: number ): number => x, 10 0,, 10, 1.0,, 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 ); + + sgemv.ndarray( "row-major", "N", '10', 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", true, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", false, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", null, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", undefined, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", [], 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", {}, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", ( x: number ): number => x, 10 0,, 1.0, A, , 010, 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 ); + + sgemv.ndarray( "row-major", "N", 10, '10', 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, true, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, false, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, null, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, undefined, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, [], 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, {}, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, ( x: number ): number => x, 1. 0,0, A, 10, , 0x, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, '10', A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, true, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, false, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, null, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, undefined, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, [], A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, {}, A, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, ( 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 ); + const A = new Float32Array( 20 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, 10, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, '10', 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, true, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, false, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, null, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, undefined, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, [ '1' ], 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, {}, 10, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, ( x: number ): number => x, 10 0,, x, 1, 0,, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, '10', x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, true, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, false, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, null, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, undefined, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, [], x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, {}, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, 10, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, '10', 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, true, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, false, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, null, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, undefined, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, [ '1' ], 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, {}, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, '10', 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, true, 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, false, 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, null, 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, undefined, 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, [], 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, {}, 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, '10', 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, true, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, false, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, null, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, undefined, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, [], 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, {}, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, '10' y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, true y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, false y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, null y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, undefined y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, [] y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, {} y, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, 10, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, '10', 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, true, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, false, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, null, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, undefined, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, [ '1' ], 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, {}, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, '10', 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, true, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, false, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, null, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, undefined, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, [], 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, {}, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, '10' ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, true ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, false ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, null ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, undefined ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, [] ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, {} ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 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 ); + + sgemv.ndarray(); // $ExpectError + sgemv.ndarray( "row-major" ); // $ExpectError + sgemv.ndarray( "row-major", "N" ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1 ); // $ExpectError + sgemv.ndarray( "row-major", "N", 10, 10, 1.0, A, 10, x, 1, 0, 1.0, y, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/examples/index.js b/lib/node_modules/@stdlib/blas/base/sgemv/examples/index.js new file mode 100644 index 000000000000..3a2038ed3ba0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/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 sgemv = require( './../lib' ); + +var opts = { + 'dtype': 'float32' +}; + +var trans = 'N'; + +var M = 3; +var N = 3; +var lda = 3; + +var alpha = 1; +var beta = 1; + +var A = discreteUniform( M*N, 0, 255, opts ); + +var x = discreteUniform( N, 0, 255, opts ); +var y = discreteUniform( M, 0, 255, opts ); + +sgemv.ndarray( 'row-major', trans, M, N, alpha, A, lda, x, -1, 2, beta, y, -1, 2 ); +console.log( y ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/lib/index.js b/lib/node_modules/@stdlib/blas/base/sgemv/lib/index.js new file mode 100644 index 000000000000..21fca498c8bc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/lib/index.js @@ -0,0 +1,90 @@ +/** +* @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` or `y = alpha*A**T*x + beta*y`. +* +* @module @stdlib/blas/base/sgemv +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var sgemv = require( '@stdlib/blas/base/sgemv' ); +* +* var trans = 'N'; +* +* var M = 2; +* var N = 3; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0 ] ); +* +* sgemv( 'row-major', trans, M, N, alpha, A, lda, x, 1, beta, y, 1 ); +* // y => [ 7.0, 16.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var sgemv = require( '@stdlib/blas/base/sgemv' ); +* +* var trans = 'N'; +* +* var M = 2; +* var N = 3; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0 ] ); +* +* sgemv.ndarray( 'row-major', trans, M, N, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); +* // y => [ 7.0, 16.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 sgemv; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + sgemv = main; +} else { + sgemv = tmp; +} + + +// EXPORTS // + +module.exports = sgemv; + +// exports: { "ndarray": "sgemv.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/lib/main.js b/lib/node_modules/@stdlib/blas/base/sgemv/lib/main.js new file mode 100644 index 000000000000..188acd0dba59 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/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 sgemv = require( './sgemv.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( sgemv, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = sgemv; diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemv/lib/ndarray.js new file mode 100644 index 000000000000..d636a319e295 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/lib/ndarray.js @@ -0,0 +1,217 @@ +/** +* @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' ); + + +// MAIN // + +/** +* Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`. +* +* @param {string} order - storage layout +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @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 {Float64Array} x - an `M` element vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {number} beta - scalar constant +* @param {Float64Array} y - an `N` element vector +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @returns {Float64Array} `y` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var trans = 'N'; +* +* var M = 2; +* var N = 3; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0 ] ); +* +* sgemv( 'row-major', trans, M, N, alpha, A, lda, x, 1, 0, beta, y, 1, 0 ); +* // y => [ 7.0, 16.0 ] +*/ +function sgemv( order, trans, M, N, alpha, A, LDA, x, strideX, offsetX, beta, y, strideY, offsetY ) { + var info; + var lenx; + var leny; + var temp; + var ix; + var iy; + var jx; + var jy; + var kx; + var ky; + var i; + var j; + + info = 0; + if ( ( trans.toUpperCase() !== 'N' ) && ( trans.toUpperCase() !== 'T' ) && ( trans.toUpperCase() !== 'C' ) ) { + info = 1; + } else if( M < 0 ) { + info = 2; + } else if ( N < 0 ) { + info = 3; + } else if ( LDA < max( 1, M ) ) { + info = 6; + } else if ( strideX === 0 ) { + info = 8; + } else if ( strideY === 0 ) { + info = 11; + } + if ( info !== 0 ) { + // throw new Error("Something went wrong"); + return y; + } + // Check if we can early return... + if ( M === 0 || N === 0 || ( alpha === 0.0 && beta === 1.0 ) ) { + return y; + } + if ( trans.toUpperCase() === 'N' ) { + lenx = N; + leny = M; + } else { + lenx = M; + leny = N; + } + kx = offsetX; + ky = offsetY; + // y = beta*y + if ( beta !== 1.0 ) { + if ( strideY === 1 ) { + if ( beta === 0.0 ) { + for ( i = 0; i < leny; i++ ) { + y[ i ] = 0.0; + } + } else { + for ( i = 0; i < leny; i++ ) { + y[ i ] *= beta; + } + } + } else { + iy = ky; + if ( beta === 0.0 ) { + for ( i = 0; i < leny; i++ ) { + y[ iy ] = 0.0; + iy += strideY; + } + } else { + for ( i = 0; i < leny; i++ ) { + y[ iy ] *= beta; + iy += strideY; + } + } + } + } + if ( alpha === 0.0 ) { + return y; + } + if ( trans.toUpperCase() === 'N' ) { + // Form y = alpha*A*x + y + jx = kx; + if ( strideY === 1 ) { + for ( j = 0; j < N; j++ ) { + if ( x[ jx ] !== 0.0 ) { + temp = alpha * x[ jx ]; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + y[ i ] += A[ i * LDA + j ] * temp; + } else { + y[ i ] += A[ j * LDA + i ] * temp; + } + + } + } + jx += strideX; + } + } else { + for ( j = 0; j < N; j++ ) { + if ( x[ jx ] !== 0.0 ) { + temp = alpha * x[ jx ]; + iy = ky; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + y[ iy ] += A[ i * LDA + j ] * temp; + } else { + y[ iy ] += A[ j * LDA + i ] * temp; + } + iy += strideY; + } + } + jx += strideX; + } + } + } else { + // Form y = alpha*A**T*x + y + jy = ky; + if ( strideX === 1 ) { + for ( j = 0; j < N; j++ ) { + temp = 0.0; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + temp += A[ i * LDA + j ] * x[ i ]; + } else { + temp += A[ j * LDA + i ] * x[ i ]; + } + } + y[ jy ] += alpha * temp; + jy += strideY; + } + } else { + for ( j = 0; j < N; j++ ) { + temp = 0.0; + ix = kx; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + temp += A[ i * LDA + j ] * x[ ix ]; + } else { + temp += A[ j * LDA + i ] * x[ ix ]; + } + ix += strideX; + } + y[ jy ] += alpha * temp; + jy += strideY; + } + } + } + return y; +} + + +// EXPORTS // + +module.exports = sgemv; diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/lib/sgemv.js b/lib/node_modules/@stdlib/blas/base/sgemv/lib/sgemv.js new file mode 100644 index 000000000000..006719c6cb92 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/lib/sgemv.js @@ -0,0 +1,222 @@ +/** +* @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' ); + +// MAIN // + +/** +* Performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`. +* +* @param {string} order - storage layout +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @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 - an `M` element vector +* @param {integer} strideX - `x` stride length +* @param {number} beta - scalar constant +* @param {Float32Array} y - an `N` element vector +* @param {integer} strideY - `y` stride length +* @returns {Float32Array} `y` +* +* @example +* var Float32Array = require( '@stdlib/array/float64' ); +* +* var trans = 'N'; +* +* var M = 2; +* var N = 3; +* var lda = 3; +* +* var alpha = 1.0; +* var beta = 1.0; +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float32Array( [ 1.0, 1.0, 1.0 ] ); +* var y = new Float32Array( [ 1.0, 1.0 ] ); +* +* sgemv( 'row-major', trans, M, N, alpha, A, lda, x, 1, beta, y, 1 ); +* // y => [ 7.0, 16.0 ] +*/ +function sgemv( order, trans, M, N, alpha, A, LDA, x, strideX, beta, y, strideY ) { + var info; + var lenx; + var leny; + var temp; + var ix; + var iy; + var jx; + var jy; + var kx; + var ky; + var i; + var j; + + info = 0; + if ( ( trans.toUpperCase() !== 'N' ) && ( trans.toUpperCase() !== 'T' ) && ( trans.toUpperCase() !== 'C' ) ) { + info = 1; + } else if( M < 0 ) { + info = 2; + } else if ( N < 0 ) { + info = 3; + } else if ( LDA < max( 1, M ) ) { + info = 6; + } else if ( strideX === 0 ) { + info = 8; + } else if ( strideY === 0 ) { + info = 11; + } + if ( info !== 0 ) { + // throw new Error("Something went wrong"); + return y; + } + // Check if we can early return... + if ( M === 0 || N === 0 || ( alpha === 0.0 && beta === 1.0 ) ) { + return y; + } + if ( trans.toUpperCase() === 'N' ) { + lenx = N; + leny = M; + } else { + lenx = M; + leny = N; + } + if ( strideX > 0 ) { + kx = 0; + } else { + kx = ( 1-lenx ) * strideX; + } + if ( strideY > 0 ) { + ky = 0; + } else { + ky = ( 1-leny ) * strideY; + } + // y = beta*y + if ( beta !== 1.0 ) { + if ( strideY === 1 ) { + if ( beta === 0.0 ) { + for ( i = 0; i < leny; i++ ) { + y[ i ] = 0.0; + } + } else { + for ( i = 0; i < leny; i++ ) { + y[ i ] *= beta; + } + } + } else { + iy = ky; + if ( beta === 0.0 ) { + for ( i = 0; i < leny; i++ ) { + y[ iy ] = 0.0; + iy += strideY; + } + } else { + for ( i = 0; i < leny; i++ ) { + y[ iy ] *= beta; + iy += strideY; + } + } + } + } + if ( alpha === 0.0 ) { + return y; + } + if ( trans.toUpperCase() === 'N' ) { + // Form y = alpha*A*x + y + jx = kx; + if ( strideY === 1 ) { + for ( j = 0; j < N; j++ ) { + if ( x[ jx ] !== 0.0 ) { + temp = alpha * x[ jx ]; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + y[ i ] += A[ i * LDA + j ] * temp; + } else { + y[ i ] += A[ j * LDA + i ] * temp; + } + + } + } + jx += strideX; + } + } else { + for ( j = 0; j < N; j++ ) { + if ( x[ jx ] !== 0.0 ) { + temp = alpha * x[ jx ]; + iy = ky; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + y[ iy ] += A[ i * LDA + j ] * temp; + } else { + y[ iy ] += A[ j * LDA + i ] * temp; + } + iy += strideY; + } + } + jx += strideX; + } + } + } else { + // Form y = alpha*A**T*x + y + jy = ky; + if ( strideX === 1 ) { + for ( j = 0; j < N; j++ ) { + temp = 0.0; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + temp += A[ i * LDA + j ] * x[ i ]; + } else { + temp += A[ j * LDA + i ] * x[ i ]; + } + } + y[ jy ] += alpha * temp; + jy += strideY; + } + } else { + for ( j = 0; j < N; j++ ) { + temp = 0.0; + ix = kx; + for ( i = 0; i < M; i++ ) { + if( order === 'row-major' ) { + temp += A[ i * LDA + j ] * x[ ix ]; + } else { + temp += A[ j * LDA + i ] * x[ ix ]; + } + ix += strideX; + } + y[ jy ] += alpha * temp; + jy += strideY; + } + } + } + return y; +} + + +// EXPORTS // + +module.exports = sgemv; diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/package.json b/lib/node_modules/@stdlib/blas/base/sgemv/package.json new file mode 100644 index 000000000000..742692932c64 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/blas/base/sgemv", + "version": "0.0.0", + "description": "Perform one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y`.", + "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", + "sgemv", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float32", + "float", + "float32array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/REQUIRE b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/REQUIRE new file mode 100644 index 000000000000..308c3be89c85 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/REQUIRE @@ -0,0 +1,2 @@ +julia 1.5 +JSON 0.21 diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xnyn.json b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xnyn.json new file mode 100644 index 000000000000..57b403a0db1f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xnyn.json @@ -0,0 +1,15 @@ +{ + "order": "column-major", + "trans": "N", + "M": 3, + "N": 2, + "alpha": 1, + "lda": 3, + "A": [1, 2, 3, 4, 5, 6], + "x": [1, 2, 3], + "strideX": -1, + "beta": 1, + "y": [7, 8, 9, 10], + "strideY": -2, + "y_out": [ 19, 8, 18, 10 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xnyp.json b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xnyp.json new file mode 100644 index 000000000000..42dc1fb63667 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xnyp.json @@ -0,0 +1,15 @@ +{ + "order": "column-major", + "trans": "N", + "M": 3, + "N": 3, + "alpha": 1, + "lda": 3, + "A": [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], + "x": [ 3, 2, 1 ], + "strideX": -1, + "beta": 1, + "y": [ 5, 6, 7, 8, 9, 10 ], + "strideY": 2, + "y_out": [ 35, 6, 43, 8, 51, 10 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xoyo.json b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xoyo.json new file mode 100644 index 000000000000..6af1c0669d15 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xoyo.json @@ -0,0 +1,15 @@ +{ + "order": "row-major", + "trans": "N", + "M": 2, + "N": 1, + "alpha": 0.00000000, + "lda": 3, + "strideX": 1, + "beta": 0.899999976, + "strideY": 1, + "A": [ 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ], + "x": [ 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ], + "y": [ 0.00000000, 0.00000000, 10.0000000, 20.0000000, 35.0000000, 56.0000000, 84.0000000, 120.000000, 165.000000, 220.000000, 286.000000, 364.000000, 455.000000, 560.000000, 680.000000, 816.000000, 969.000000, 1140.00000, 1330.00000, 1540.00000, 1771.00000, 2024.00000, 2300.00000, 2600.00000, 2925.00000, 3276.00000, 3654.00000, 4060.00000, 4495.00000, 4960.00000, 5456.00000, 5984.00000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ], + "y_out": [ 0.00000000, 0.00000000, 10.0000000, 20.0000000, 35.0000000, 56.0000000, 84.0000000, 120.000000, 165.000000, 220.000000, 286.000000, 364.000000, 455.000000, 560.000000, 680.000000, 816.000000, 969.000000, 1140.00000, 1330.00000, 1540.00000, 1771.00000, 2024.00000, 2300.00000, 2600.00000, 2925.00000, 3276.00000, 3654.00000, 4060.00000, 4495.00000, 4960.00000, 5456.00000, 5984.00000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xoyt.json b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xoyt.json new file mode 100644 index 000000000000..8811e50983be --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xoyt.json @@ -0,0 +1,15 @@ +{ + "order": "row-major", + "trans": "N", + "M": 2, + "N": 1, + "alpha": 0.00000000, + "lda": 3, + "strideX": 1, + "beta": 0.899999976, + "strideY": 2, + "A": [ 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ], + "x": [ 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ], + "y": [ 0.00000000, 0.00000000, 0.00000000, 20.0000000, 35.0000000, 56.0000000, 84.0000000, 120.000000, 165.000000, 220.000000, 286.000000, 364.000000, 455.000000, 560.000000, 680.000000, 816.000000, 969.000000, 1140.00000, 1330.00000, 1540.00000, 1771.00000, 2024.00000, 2300.00000, 2600.00000, 2925.00000, 3276.00000, 3654.00000, 4060.00000, 4495.00000, 4960.00000, 5456.00000, 5984.00000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ], + "y_out": [ 0.00000000, 0.00000000, 0.00000000, 20.0000000, 35.0000000, 56.0000000, 84.0000000, 120.000000, 165.000000, 220.000000, 286.000000, 364.000000, 455.000000, 560.000000, 680.000000, 816.000000, 969.000000, 1140.00000, 1330.00000, 1540.00000, 1771.00000, 2024.00000, 2300.00000, 2600.00000, 2925.00000, 3276.00000, 3654.00000, 4060.00000, 4495.00000, 4960.00000, 5456.00000, 5984.00000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xpyn.json b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xpyn.json new file mode 100644 index 000000000000..0665da305a12 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xpyn.json @@ -0,0 +1,15 @@ +{ + "order": "row-major", + "trans": "N", + "M": 2, + "N": 3, + "alpha": 1, + "lda": 3, + "A": [ 1, 2, 3, 4, 5, 6 ], + "x": [ 1, 2, 3 ], + "strideX": 1, + "beta": 1, + "y": [ 7, 8, 9, 10 ], + "strideY": -2, + "y_out": [ 39, 8, 23, 10 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xpyp.json b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xpyp.json new file mode 100644 index 000000000000..3d4b3d0ba835 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/fixtures/julia/strides_xpyp.json @@ -0,0 +1,15 @@ +{ + "order": "row-wise", + "trans": "N", + "M": 2, + "N": 3, + "alpha": 1, + "lda": 3, + "A": [1, 2, 3, 4, 5, 6], + "x": [1, 1, 1], + "strideX": 1, + "beta": 1, + "y": [1, 1], + "strideY": 1, + "y_out": [ 7.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/test.js b/lib/node_modules/@stdlib/blas/base/sgemv/test/test.js new file mode 100644 index 000000000000..2964493396f9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/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 sgemv = 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 sgemv, '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 sgemv.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 sgemv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( sgemv, 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 sgemv; + var main; + + main = require( './../lib/sgemv.js' ); + + sgemv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( sgemv, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemv/test/test.ndarray.js new file mode 100644 index 000000000000..8b77e72b0e8c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/test.ndarray.js @@ -0,0 +1,338 @@ +/** +* @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 scopy = require( '@stdlib/blas/base/scopy' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var sgemv = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var stridesxoyo = require( './fixtures/julia/strides_xoyo.json' ); +var stridesxoyt = 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 sgemv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 14', function test( t ) { + t.strictEqual( sgemv.length, 14, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` (sx=1, sy=1)', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridesxoyo.order; + trans = stridesxoyo.trans; + + m = stridesxoyo.M; + n = stridesxoyo.N; + lda = stridesxoyo.lda; + + alpha = stridesxoyo.alpha; + beta = stridesxoyo.beta; + + a = new Float32Array( stridesxoyo.A ); + x = new Float32Array( stridesxoyo.x ); + y = new Float32Array( stridesxoyo.y ); + + expected = new Float32Array( stridesxoyo.y_out ); + + out = sgemv( order, trans, m, n, alpha, a, lda, x, 1, 0, beta, y, 1, 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 `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` (sx=1, sy=2)', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridesxoyt.order; + trans = stridesxoyt.trans; + + m = stridesxoyt.M; + n = stridesxoyt.N; + lda = stridesxoyt.lda; + + alpha = stridesxoyt.alpha; + beta = stridesxoyt.beta; + + a = new Float32Array( stridesxoyt.A ); + x = new Float32Array( stridesxoyt.x ); + y = new Float32Array( stridesxoyt.y ); + + expected = new Float32Array( stridesxoyt.y_out ); + + out = sgemv( order, trans, m, n, alpha, a, lda, x, 1, 0, beta, y, 2, 0 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports `y` offset', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexpyn.order; + trans = stridexpyn.trans; + + m = stridexpyn.M; + n = stridexpyn.N; + lda = stridexpyn.lda; + + 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 = sgemv( order, trans, m, n, alpha, a, lda, x, 1, 0, beta, y, -2, 2 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports `x` offset', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexnyp.order; + trans = stridexnyp.trans; + + m = stridexnyp.M; + n = stridexnyp.N; + lda = stridexnyp.lda; + + 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 = sgemv( order, trans, m, n, alpha, a, lda, x, -1, 2, beta, y, 2, 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 alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexpyp.order; + trans = stridexpyp.trans; + + m = stridexpyp.M; + n = stridexpyp.N; + lda = stridexpyp.lda; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + out = sgemv( order, trans, m, n, alpha, a, lda, x, 1, 0, beta, y, 1, 0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided an `M` or `N` parameter less than to `0`, the function leaves both input arrays unchanged', function test( t ) { + var alpha; + var order; + var trans; + var beta; + var lda; + var xe; + var ye; + var a; + var m; + var n; + var x; + var y; + + order = stridexpyp.order; + trans = stridexpyp.trans; + + m = stridexpyp.M; + n = stridexpyp.N; + lda = stridexpyp.lda; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + xe = new Float32Array( x.length ); + scopy( x.length, x, 1, xe, 1 ); + + ye = new Float32Array( y.length ); + scopy( y.length, y, 1, ye, 1 ); + + sgemv( order, trans, -1, n, alpha, a, lda, x, 1, 0, beta, y, 1, 0 ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); + + sgemv( order, trans, m, -1, alpha, a, lda, x, 1, 0, beta, y, 1, 0 ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexnyn.order; + trans = stridexnyn.trans; + + m = stridexnyn.M; + n = stridexnyn.N; + lda = stridexnyn.lda; + + 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 = sgemv( order, trans, m, n, alpha, a, lda, x, -1, 1, beta, y, -2, 4 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/sgemv/test/test.sgemv.js b/lib/node_modules/@stdlib/blas/base/sgemv/test/test.sgemv.js new file mode 100644 index 000000000000..7aac5ceb71c2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemv/test/test.sgemv.js @@ -0,0 +1,338 @@ +/** +* @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 scopy = require( '@stdlib/blas/base/scopy' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var sgemv = require( './../lib/sgemv.js' ); + + +// FIXTURES // + +var stridesxoyo = require( './fixtures/julia/strides_xoyo.json' ); +var stridesxoyt = 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 sgemv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( sgemv.length, 12, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` (sx=1, sy=1)', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridesxoyo.order; + trans = stridesxoyo.trans; + + m = stridesxoyo.M; + n = stridesxoyo.N; + lda = stridesxoyo.lda; + + alpha = stridesxoyo.alpha; + beta = stridesxoyo.beta; + + a = new Float32Array( stridesxoyo.A ); + x = new Float32Array( stridesxoyo.x ); + y = new Float32Array( stridesxoyo.y ); + + expected = new Float32Array( stridesxoyo.y_out ); + + out = sgemv( order, trans, m, n, alpha, a, lda, x, 1, beta, y, 1 ); + 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 `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` (sx=1, sy=2)', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridesxoyt.order; + trans = stridesxoyt.trans; + + m = stridesxoyt.M; + n = stridesxoyt.N; + lda = stridesxoyt.lda; + + alpha = stridesxoyt.alpha; + beta = stridesxoyt.beta; + + a = new Float32Array( stridesxoyt.A ); + x = new Float32Array( stridesxoyt.x ); + y = new Float32Array( stridesxoyt.y ); + + expected = new Float32Array( stridesxoyt.y_out ); + + out = sgemv( order, trans, m, n, alpha, a, lda, x, 1, beta, y, 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 `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` (sx=1, sy=-2)', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexpyn.order; + trans = stridexpyn.trans; + + m = stridexpyn.M; + n = stridexpyn.N; + lda = stridexpyn.lda; + + 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 = sgemv( order, trans, m, n, alpha, a, lda, x, 1, beta, y, -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 `y = alpha*A*x + beta*y` or `y = alpha*A**T*x + beta*y` (sx=-1, sy=2)', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexnyp.order; + trans = stridexnyp.trans; + + m = stridexnyp.M; + n = stridexnyp.N; + lda = stridexnyp.lda; + + 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 = sgemv( order, trans, m, n, alpha, a, lda, x, -1, beta, y, 2 ); + 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 alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexpyp.order; + trans = stridexpyp.trans; + + m = stridexpyp.M; + n = stridexpyp.N; + lda = stridexpyp.lda; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + out = sgemv( order, trans, m, n, alpha, a, lda, x, 1, beta, y, 1 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided an `M` or `N` parameter less than to `0`, the function leaves both input arrays unchanged', function test( t ) { + var alpha; + var order; + var trans; + var beta; + var lda; + var xe; + var ye; + var a; + var m; + var n; + var x; + var y; + + order = stridexpyp.order; + trans = stridexpyp.trans; + + m = stridexpyp.M; + n = stridexpyp.N; + lda = stridexpyp.lda; + + alpha = stridexpyp.alpha; + beta = stridexpyp.beta; + + a = new Float32Array( stridexpyp.A ); + x = new Float32Array( stridexpyp.x ); + y = new Float32Array( stridexpyp.y ); + + xe = new Float32Array( x.length ); + scopy( x.length, x, 1, xe, 1 ); + + ye = new Float32Array( y.length ); + scopy( y.length, y, 1, ye, 1 ); + + sgemv( order, trans, -1, n, alpha, a, lda, x, 1, beta, y, 1 ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); + + sgemv( order, trans, m, -1, alpha, a, lda, x, 1, beta, y, 1 ); + t.deepEqual( x, xe, 'returns expected value' ); + t.deepEqual( y, ye, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var alpha; + var order; + var trans; + var beta; + var lda; + var out; + var a; + var m; + var n; + var x; + var y; + + order = stridexnyn.order; + trans = stridexnyn.trans; + + m = stridexnyn.M; + n = stridexnyn.N; + lda = stridexnyn.lda; + + 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 = sgemv( order, trans, m, n, alpha, a, lda, x, -1, beta, y, -2 ); + isApprox( t, y, expected, 2.0 ); + t.strictEqual( out, y, 'returns expected value' ); + t.end(); +});